jQuery
Handle unload event with jQuery
by Jean-Marc Amiaud le 23 Déc 2010, catégorie jQuery, Programmation
After a lot of research over internet, to know how it’s possible to handle unload event with jQuery, I have found the solution ! But I’ve seen lot of error… the reason of my post.
The unload event is fired by window element and NOT by the document element !
So you have to handle the event from window element like this :
jQuery(window).unload(function() { alert(‘Window unload event is fired !’); });
That’s all !