Advertisement
Home Open Editor ❯

HTML onunload event Attribute

Example

<body onunload="myFunction()">

Try this code ❯

Meaning

The onunload attribute specifies that the browser is leaving the current document and unloading it from the window or frame.

There may be another possible use for this event when elements bind to remote data sources and unload.


Standard Syntax

<element onunload="script">


Advertisement

Attribute Values

Value Description
script Specifies the script to be run on onunload.

Technical Details

Supported HTML elements:

<body>
Home Open Editor ❯
Advertisement