Page 1 of 1

javascript

PostPosted: Thu Jul 15, 2010 10:35 pm
by ansuriya
How to catach a close event on a website without javascript? How can i catch a close event on a web page without the use of javascript. I have a site that a users has to log in to and from that I have to keep track of if they are logged in or not. My problem now comes when the user has to be marked as logged out. How can I solve the problem that when the browser closes unexpectedly that it then carries out a method that will mark the user as logged out. The log out methods works when the users logs out and then closes the application.
__________________________
market samurai ~ marketsamurai ~ marketsamurai.com

Re: javascript

PostPosted: Tue Jul 20, 2010 9:57 am
by shannah
There's no sure-fire method. All you can really do is keep track of their last request and store the time of it in the database. And if there haven't been any requests in a while you could consider them logged out. You could use AJAX to periodically poll the server to let it know that the page is still opened.

If you don't absolutely need to know if they are logged in, then I probably wouldn't worry about it.