Onbeforeunload does not work if the user returns

I use

 $(window).bind('beforeunload', function() {
        $.post("save.php",{name:moves});
 }); 

It works very well, but only if the user closes the page. If the user comes back or enter another site, it does not work. What event should I use? (It should fire when the user leaves)

+3
source share
1 answer

You can find this one very interesting. :)

The above thread came down to this , a plugin called Asual.

My 10 cents on this plugin. A well-written, well-maintained, very flexible plugin with an excellent reference API, which made it very easy to implement.

-1
source

All Articles