Gets or sets a value that indicates whether to warn the user prior to navigating away from a page.
Property of dom/BeforeUnloadEventdom/BeforeUnloadEvent
Syntaxvar returnValue = event.returnValue;
event.returnValue = preventNavigationReason;
Return Value
Returns an object of type StringString
The text that will be shown to the user.
Examples
window.onbeforeunload = function (e) {
e.returnValue = "About to navigate away from this page";
};
Usage
The BeforeUnloadEvent allows you to warn a user who is navigating away from a page or closing the browser. Set the return value to false or a string value to cancel the document unload event. You can also return a string or Boolean value from the event handler to display a message to the user, who is asked to confirm that they want to unload the document.
Related specifications
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4