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.
精彩评论