Question:

Is it possible to make an ajax request onBeforeUnload?

by  |  earlier

0 LIKES UnLike

...When the user clicks ok to close the window.

What I'm trying to do is to save in the database the time when the user logs out.

If there's any other suggestion that doesn't involve using ajax i'm open to listen.

I'm using PHP MySQL

Thanks!

 Tags:

   Report

1 ANSWERS


  1. I use this on all sites:

    <BODY onresize='js_resize();return false;' onunload='js_log_off();return false;'>

    The function js_log_off() is an AJAX call that updates the DB, remove the session number from the DB, cloase any opened file etc...

    I found that "onBEFOREunload" is not reliable with all browsers.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.