HTML onunload event Attribute
Example
<body onunload="myFunction()">
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">
Browser Support
Status
Attribute Values
Value | Description |
---|---|
script | Specifies the script to be run on onunload. |
Technical Details
Supported HTML elements:
<body>