A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/BeforeUnloadEvent/returnValue below:

returnValue ยท WebPlatform Docs

returnValue Summary

Gets or sets a value that indicates whether to warn the user prior to navigating away from a page.

Property of dom/BeforeUnloadEventdom/BeforeUnloadEvent

Syntax
var 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
HTML5
Working Draft
WHATWG HTML
Living Standard
Attributions

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