• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Sandeep. Oza
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • 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.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • 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?
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!