jQuery in Action, 3rd edition
The moose likes JSP and the fly likes Browser Closing without signout from site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Browser Closing without signout from site" Watch "Browser Closing without signout from site" New topic

Browser Closing without signout from site

Malli Pondugula

Joined: Dec 11, 2001
Posts: 1
I am using Tomcat 3.2 version. I have an application in which
i have to capture user login and logout time. I am storing the
login time and logout time in database table.
If user logout by clicking logout button then page navigate to some processing page in which i take the logout time and stored in database table.
My problem is "If user close the browser after login into the application without logout then i am unable to capture the logout time".
Can any one help me how to find out the logout time when user closes the browser directly after login without logout.
Adv Tks,


Jesper Ottosson
Ranch Hand

Joined: Mar 21, 2000
Posts: 51
You'll have to use JavaScript to capture the event that the browser is closing, and make it request some jsp page which tells your system that the user has logged out.
It's not a very good solution, since it's pretty browser dependent, and probably it could be solved by designing your application in some other way.
s choukse

Joined: Dec 12, 2001
Posts: 27
zem can u elaborate it a little more as i am having the same problem
how to invoke a jsp using javascript
Bill Siggelkow
Ranch Hand

Joined: Jun 27, 2001
Posts: 57
This is a difficult problem to solve and have not found an actual workable solution. Instead, I record the time that the user explicitly logs out; or, if he doesn't log out, I record the time that the session expires (set to 30 minutes) by using an HttpSessionBindingListener to determine when the session is invalidated by the servlet container.

Bill Siggelkow
Jade Cove Solutions
I agree. Here's the link: http://aspose.com/file-tools
subject: Browser Closing without signout from site
It's not a secret anymore!