开发者

what is the difference between window.unload and window.onunload

开发者 https://www.devze.com 2023-03-18 19:23 出处:网络
I\'ve tested both of them and they work as expected in Opera, IE, FF and Chrome. I\'ve searched window.unload on google and https://developer.mozilla.org/en-US/search?q=window.unload but it didn\'t he

I've tested both of them and they work as expected in Opera, IE, FF and Chrome. I've searched window.unload on google and https://developer.mozilla.org/en-US/search?q=window.unload but it didn't help much. What is the difference between them or window.unload is just the older v开发者_如何学JAVAersion of window.onunload?


window.onunload is event handler. When you, or user, call window.unload, the event is triggered and window.onunload is called. So you can redefine window.onunload any way you like to, for example, display a confirmation dialog before unloading, send some data to the server of whatever else.

0

精彩评论

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