This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes recording time when the user closed browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "recording time when the user closed browser" Watch "recording time when the user closed browser" New topic

recording time when the user closed browser

as chhipa

Joined: Sep 04, 2006
Posts: 26
Hi everybody,
I want to know if there is any mechanism is JSP through which we can detect the time when user closed the browser window so that we can record the logout time in database. It will be very nice if you can provide the sample code also.
Thank you.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

There is nothing in JSP for this.

There is no reliable way to know when a user closes a browser from the server.
  • Http is a stateless protocol
  • Computers crash.
  • Network connections dissapear.
  • Browsers can be configured to do or not do lots of things.
  • Users could type new URLs in the browser's address bar.

  • [ September 27, 2006: Message edited by: Ben Souther ]

    Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    I agree. Here's the link:
    subject: recording time when the user closed browser
    It's not a secret anymore!