<body onUnload=””>

Attribute of
<body> HTML Tag
What does <body onUnload=""> do?
Fires a script when the visitor leaves the page.

The onUnload attribute is an event handler that instructs the browser to run a script when the visitor leaves the page.

Example usage

<body onUnload="script">

Points to be aware of

body event handlers act on the browser window, so the onUnload is commonly used to bring up JavaScript alert when the visitor exits a website. Some visitors may find this behavior unhelpful, so it’s best used sparingly.

Browser Support for onUnload

AllAllAllAllAllAll