Home > Uncategorized > Cookies in Firefox and Internet Explorer

Cookies in Firefox and Internet Explorer

Mmm…cookies…

Firefox and IE handle them differently. Go figure…

Firefox always shares cookies – across tabs and across windows. No matter how your windows or tabs come into existence, cookies are always shared in Firefox.

IE 7 sometimes shares cookies. It always shares cookies in new tabs. It always shares cookies with the new window if you choose File -> New Window from the menu (or use Ctrl+N). However, if you have an IE window open and you use the Start menu or double-click a desktop icon to open another instance of IE, it will not share cookies.

Seems really strange to me, as clicking File -> New Window appears to do the same thing as double-clicking the IE icon on my desktop. Both show up in the taskbar at the bottom of the screen. Both show up in the Task Manager under the Applications tab. But further investigation shows that only one shows up in the Processes tab of the Task Manager.

IE 7 spawns a new process when you open it from the Start menu or the desktop. However, it uses the same process if you open a new window from an existing IE process. This explains why cookies are shared when you use File -> New Window or Ctrl+N.

I ran into problems with this while working on a web application using Servlets & JSP. (If you’re looking for a great reference, check out Head First Servlets & JSP). Once I realized that a session means something different in IE than it does in Firefox, it all made sense, but I spent a lot of time learning this the hard way.

Can’t all browsers act the same?

Advertisements
  1. Marc Peabody
    May 19, 2008 at 12:12 pm

    This may only be true for session cookies in IE. I think if you set an expiration date on your Cookies, they will be shared.

    If FireFox shares all cookies, including a JSESSIONID, doesn’t that mean that you can’t mimic (to, say, test a stale data / race condition) two separate sessions running at the same time… at least without needing 2 computers to do so? That doesn’t seem terribly desirable either.

  2. May 21, 2008 at 8:29 pm

    Marc – in the tests I ran, I found that the JSESSIONID was always the same in Firefox, no matter how I opened new tabs or windows (including running the exe). This held true until I shut down Firefox entirely and restarted it, at which point I received a new JSESSIONID. In IE, the JSESSIONID was different for each running process of IE.

    The JSESSIONID seems to have a one-to-one relationship with the number of processes. Since Firefox never creates more than one process, no matter how you run it, the JSESSIONID is always the same. This is not true for IE – each time you run the executable, IE creates a new process (at least for IE 7), and the JSESSIONID is different.

  3. May 21, 2008 at 8:38 pm

    Here’s another post I found discussing the same topic. It may give you a different perspective and further explanation. One thing he mentioned that I wasn’t aware of was that it seems that JavaScript calls such as window.open use the currently running process, rather than spawning a new one.

  4. Rama
    May 30, 2008 at 6:31 am

    Try using the command “firefox -ProfileManager -no-remote” – and create multiple profiles. That way you will be able to have separate cookies for Firefox

  5. July 26, 2013 at 10:43 pm

    I am not sure the place you’re getting your info, however great topic. I must spend some time studying more or working out more. Thank you for great information I was searching for this info for my mission.

  6. July 26, 2013 at 10:53 pm

    Today, I went to the beachfront with my children.
    I found a sea shell and gave it to my 4 year old daughter and
    said “You can hear the ocean if you put this to your ear.” She placed the shell to
    her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely off topic but I
    had to tell someone!

  7. January 21, 2014 at 11:34 pm

    I visited various blogs but the audio feature for audio songs present at this web page is
    in fact superb.

  8. January 23, 2016 at 7:42 pm

    I’m just looking for place to start up a blog with a friend where we talk sports in Chicago as well as other things going on nationwide….just for fun. Any suggestions on sites would be great. Thanks..

  1. December 31, 2009 at 3:17 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: