views:

43

answers:

2

i want to know when account logout without logout button click.

actually i want to manage dashboard. with some events like login, logout with it's activity date and time.

so if any user login so i will entry for login. and if any user direct close browser so how can i manage logout entry in database.

+1  A: 

You cannot reliably detect the user closing the browser or leaving the website.

The way this is typically done is by measuring inactivity period - if the user has had no activity for, say, 15 minutes, assume that he has left.

driis
+1  A: 

The browser will fire a clientside event when it is closing, you should then be able to send a request to your server using javascript.

But as driis said, it is not 100% reliable.

http://aspalliance.com/1294_codesnip_handle_browser_close_event_on_the_serverside EDIT: Sorry, that article was not nearly as useful as i thought.

Moulde
Could you not do a combination, where if get the close signal, you immediately call them logged out, or if they have no activity for **x** min, you can call them logged out.
C. Ross