The onunload
attribute event is triggered
when a page has unloaded by navigating to other page or by closing
the browser window.
None.
<element onunload="script or Javascript function name">
<body>
onunload |
No | Yes | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<head>
<script>
function goodbye(){<!-- ww w .j ava 2s. c om-->
alert("on unload");
}
</script>
</head>
<body onunload="goodbye()">
<p>Close this window or press F5 to reload the page.</p>
</body>
</html>