Jean-Marc Amiaud

Handle unload event with jQuery

by on Déc.23, 2010, under 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 !


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!