BeforeUnloadEvent - Web APIs | MDN

Instance properties

Inherits properties from its parent, Event.

returnValue Deprecated

When set to a truthy value, triggers a browser-controlled confirmation dialog asking users to confirm if they want to leave the page when they try to close or reload it. This is a legacy feature, and best practice is to trigger the dialog by invoking event.preventDefault(), while also setting returnValue to support legacy cases.

Instance methods

Inherits methods from its parent, Event.

Specifications

Specification
HTML
# the-beforeunloadevent-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.