Jump to content
Larry Ullman's Book Forums

Browser Unload

Recommended Posts

Hi Larry,

On pages 284-5 you mention the browser unload event.

I'd appreciate your advice re what I imagine is a common issue in that if someone just closes the browser without logging out I want to be able to update a database table to set a logged-out condition. Can this be done reliably either with native JavaScript or jQuery initiating an AJAX call to a PHP module to effect the database update?

My program is PHP with lots of jQuery.

Looking forward to your advice re this or similar functionality and thank you in anticipation.

Cheers, Necuima

Edited by Necuima
Additional information.
Link to comment
Share on other sites

You can't rely upon a browser event for something like this. But if you use sessions or cookies, those will automatically expire. Or you can store a timestamp in the database to reflect the most recent activity and then add logic that checks that value. 

Link to comment
Share on other sites


  • Create New...