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

How To Handel The Browser Close Event in Servlets?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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