Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to kill the session on browser close

 
anmol kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to kill the session on browser closes using java.
i.e, want to capture the event on the browser closes and then kill the session.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can invalidate the session using session.invalidate() method.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anmol,
Browsers don't tell servers that the user is closing her browser though. You would have to try some sort of JavaScript for that solution. If you can manage that, only then could you invalidate the session.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Submitting to the server on browser close only works in IE. Search the HTML forum for details. It's been discussed there serveral times.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic