Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browser closing detection for session handling

 
Ricardo Celma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that this post perhaps belongs to the javascript forum, but I need some help to invalidate a session.

Currently I have used HttpSessionListener to find if the session has timed out or the user has used the logout button.

What I want to do is to detect when the user closes the tab/window where my application is, in order to destroy the session, so he/she can log again if the user opens another window (only one session per user is allowed).

I know that in Firefox I can use the onclose event to send that information to the server, but I also need to do it in Internet Explorer and chrome (at least).

Care to share any suggestions? Thank you very much in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please SearchFirst. You will find that this issue has been discussed dozens of times, and that the conclusion is always that you cannot detect when the browser is closing, and you must rely on the session timeout to allow the session to invalidate itself when the timeout expires.
 
Ricardo Celma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic