I'm looking for some good explanation of the unload event. how it works, who supports it and any bugs and pitfalls involved. I just learned of it recently and have been able to find little documentation.

3 answers


As Alex explained, the event runs when a user exits the page and it cannot be stopped. Well, to be exact, it can be stopped in IE with help of onBeforeUnload.

Some web applications use the unload event to save their users' work before they quit the page.

Answered over 7 years ago by Anatoli Papirovski
Alex Holt 341

google is your friend.


Answered over 7 years ago by Alex Holt
Jakob 17

It will work with (since) * Javascript 1 * Netscape 2.0 * IE3 * Opera 5.12 * FireFox 1 * Safari 1.0

--- Note for Non Linux Users ---

Since safari and konquerer are based on webkit like Crome it will work on crome as well.

onUnload is used to get changes / time differences that may have happend, for example via the opener object or an AJAX request between the two steps or a frame.

---For Developers---

As well it can be very useful since the IE never destroys a JS Object and it will remain till the whole Process has been closed to free unused memory of object instances or to renew a JS object on reloading/refreshing a page for example debugging

I hope this helps a little

Answered over 7 years ago by Jakob