Here I have an anchor tag in my html page which will go to Google when I click. I have a jQuery function which needs to be fired when the page leaves.
$(window).unload(function(){
alert('fffffffff');
});
I found this works fine in a video tutorial. But it's not working for me. Using firefox. help
Its working fine, you just need to remove the alert
, as some browsers don't allow alert on unload
event.
$(window).unload(function(){
console.log("hello");
});
try this http://jsfiddle.net/vyMdF/
Just run it again and you can check the console.
You can refer over here $(window).unload is not firing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With