This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JSP and the fly likes logout on browser close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "logout on browser close" Watch "logout on browser close" New topic

logout on browser close

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
How do I run logout routine when user closes a browser?

All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

I wouldn't bother trying. It requires correctly catching browser events client-side (and firing off a request to the server) which is a black art, and never works the way you want it to. Easier is to timeout idle sessions.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
thanks for the info!
I agree. Here's the link:
subject: logout on browser close
jQuery in Action, 3rd edition