I use the following code to test onunload event in jQuery
It works fine on FF, CHROME, but does not display a warning in IE9 when the window is closed. Any workaround?
You can use beforeunload
$(window).bind("beforeunload", function() { alert("Bye now!"); });
But be careful if you need to submit a form to this page: How to capture a browser window closing event?
Well, try onbeforeunload (Microsoft thingy)
$(window).bind("onbeforeunload", function(){ alert('Bye now!'); });