• 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

Closing of Browser Window with 'X' button should Logout the User.

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
When User closes the browser window I want user's session should be killed insted of waiting till session time out.
I tried body's onUnload() event for making user session invalidate, but the same event get's fired even the user refreshes the page he get's logged out.
I need the event which will only fire on window close and not with the window refresh.
Thanks in advance.
Regards,
Sandeep.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
realize that even when you do get this working that you can't rely on it 100% of the time -- what if someone just goes to another website instead of closing the window? what if they don't have javascript enabled?
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will be difficult and not reliable to trap that event. As explained by Jessica, not all users enable javascript in their browsers. Besides, session handling uses cookies in the background anyway.
 
reply
    Bookmark Topic Watch Topic
  • New Topic