Test Summary

The unload event is raised when the document is unloaded.


window.onunload = funcRef;
  • funcRef is a reference to a function.



<title>onunload test</title>

<script type="text/javascript">

window.onunload = unloadPage;

function unloadPage()
 alert("unload event detected!");

<p>Reload a new page into the browser<br />
 to fire the unload event for this page.</p>
<p>You can also use the back or forward buttons<br />
 to load a new page and fire this event.</p>


Note that using this event handler in your page prevents Firefox 1.5 from caching the page in the in-memory bfcache. See Using Firefox 1.5 caching for details.

Browsers equipped with pop-up window blockers will ignore all method calls in onunload event handler functions.


DOM Nivel 0. No es parte de ninguna norma.