• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

onUnload by reload or window close

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my application, user session will be invalidated if user closes window. If user reload page, session will not be invalidated. So I want to findout whether onUnload event triggered by reload page or window close.

Any workaround on this regard. Please find below my sample code. The logoff.html has code to invalidate session. Its working almost in IE but not in FireFox.



Thanks in advance,
Prasad Babu.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Prasad Babu:
In my application, user session will be invalidated if user closes window

Actually, no it won't. The server has no idea that you've closed the window. The session will remain valid until it times out or is explicitly invalidated.

But by closing the browser window you can no longer connect to the session. But the session is not invalidated by the act of closing the window.
 
Prasad Babu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear Bibeault,

Thanks your reply.

But it was working in IE6. Any workaround on this.

Thanks in Advance,

With regards,
Prasad babu
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a hack to get it to work in IE6 and under, not sure about IE7. Other things that close the browser sure as alt f4, an internal browser error, closing via the bar at the bottom, and so on will not be caught.

A webapplication is not same as a client application and you really do not have control over it. You can try to do hacks, but you will always have to rely on the session timeout on the server OR teaching he users how to use the application properly.

Eric
 
Prasad Babu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,

Thanks for your reply. The code I have used is


Now this is not working in IE7.

Any suggestions...

Thanks in advance.
Prasad
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic