Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session counter: ok Mozilla, !ok in IE

 
M. Pr�pper
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I tried a simple counter that persists using a HttpSession object very similar to that in post 'Session Tracker' somewhat lower in the list. It works fine in Mozilla: refreshing increments the counter, upon opening a second browser the same counter (same ID) starts at the incremented value and after closing all windows and restarting the counter the value is also ok.

In internet explorer only refreshing (F5) works. Upon opening a second window a second counter is started (new session, new ID)! Two counters work in parallel now. After closing all windows and restarting a new counter (sessions) starts, too.

Does anybody recognize this behaviour and what setting in IE causes this behaviour?
Thanks for answering, Marc
 
damien malone
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In IE, the second window has to be opened by the first window (javascript or href to a new window) or by selecting 'file', 'New', 'Window' (or ctrl+n) for a new window to open that is in the same session as the first window. If you just simply click on the ie icon, the second window will be opened, but with a new session.

The have to press 'F5' is got to do with your browser settings, select 'Tools', 'Internet Options'. In the temporary files section on the general tab, select 'settings. Check here that your browser always looks for new versions of a page, rather than reading it from the cache.

HTH
Damien
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In IE, the second window has to be opened by the first window


The reason for this has to do with the way IE shares cookies. Since the session is kept track of via a cookie, windows that share cookies will share a session, while windows that do not share cookies will not share the session.
 
M. Pr�pper
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Opening a new window from within the main window works fine indeed.

Then, I changed the setting as suggested to search always for a newer file. No caching. Upon opening a new window from the launch bar the counter has the correct value. But an F5 refreshing restarts the counter at its initial value. Strange. Further refreshing through F5 makes the counter increment as usual.

The applicability of a session object seems more limited than I'd hoped. In mozilla I can set the maxInactiveInterval at -1 (no automatic invalidation after a certain time), close all windows, restart the server and still the session persists (quite surprised that it holds even after restarting the server).

Thanks for answering, Marc
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, IE has the correct behaviour while Mozilla does not...

Session should be bound to browser instance, not browser window instance as is the case with Mozilla.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic