Win a copy of Functional Reactive Programming this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic

How To Handel The Browser Close Event in Servlets?

 
ramakrishna rayudu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi..

i have requirement that when ever the user closed the Browser or tab i need to invalidate the session
can any one give idea how to do this?

Thanks,
Ramakrishna Rayudu.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is not something that is achievable. You can get pretty close by registering a JavaScript function that is fired on the window onunload event which can call code to invalidate the session, but this can not be guaranteed to fire in all situations (e.g. browser process killed via task manager, power cable being pulled etc.). Safer and easier is to include a session timeout.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Also this has been discussed myriad times. Please SearchFirst.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic