开发者

unload Issue in IE 9.0

I am using the following code to check onunload event in Jquery

$(window).unload( function () { alert("Bye now!"); } );

It works great on FF, CHROME, but doesnt display the alert on IE9 when the window is closed. Any workaround ?开发者_C百科


You can use beforeunload

$(window).bind("beforeunload", function() { alert("Bye now!"); });

But be careful if you need to submit a form on that page: How to capture the browser window close event?


Well, try onbeforeunload (Microsoft thingy)

$(window).bind("onbeforeunload", function(){
    alert('Bye now!');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜