Reputation: 215
I have problem with jquery unload. It Doesn't WORK !
JS code :
$(window).unload(function(){
alert("Goodbye!");
});
HTML :
<a href="http://google.com">Google</a>
jsfiddle : http://jsfiddle.net/RVuU7/
Upvotes: 3
Views: 2313
Reputation: 20491
Use this instead
window.onbeforeunload = function () {
alert("Goodbye!");
};
Upvotes: 3
Reputation: 6894
Try
$(window).on('unload',function(){
alert("Goodbye!");
});
instead.
Here's the fiddle - http://jsfiddle.net/v3J5t/
According to the .unload()
documentation , it was deprecated in JQuery 1.8
Upvotes: 3