HTML onbeforeunload event Attribute
Example
<body onbeforeunload="return myFunction()">
Meaning
The onbeforeunload attribute is invoked just before a page or object is unloaded from the user agent.
Standard Syntax
<element onbeforeunload="script">
Advertisement
Attribute Values
| Value | Description |
|---|---|
| script | Specifies the script to be run on onbeforeunload |
Technical Details
Supported HTML elements:
<body>