File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Session handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Session handling" Watch "Session handling" New topic

Session handling

Raj Joe
Ranch Hand

Joined: Oct 15, 2004
Posts: 41
How do i clear the http session data when the user closes the browser.
Can i invalidate a user session when the user closes the browser.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
You might be able to use JavaScript to send some request back to the server upon closing the browser window. I don't know for sure.

I do know that this is not a Java in General (beginners) type question.

If you're looking for a better understanding of how sessions are handled in Java-based web applications, I recommend moseying on over to the Servlets forum.

I'm moving this thread to the HTML and JavaScript forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33107

You can't do this in Netscape at all. There is no way to detect the browser close. The best you can do is let the session timeout.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Session handling
It's not a secret anymore!