files/en-us/web/api/beforeunloadevent/index.md
{{APIRef("HTML DOM")}}
The BeforeUnloadEvent interface represents the event object for the {{domxref("Window/beforeunload_event", "beforeunload")}} event, which is fired when the current window, contained document, and associated resources are about to be unloaded.
See the {{domxref("Window/beforeunload_event", "beforeunload")}} event reference for detailed guidance on using this event.
{{InheritanceDiagram}}
Inherits properties from its parent, {{DOMxRef("Event")}}.
event.preventDefault(), while also setting returnValue to support legacy cases.Inherits methods from its parent, {{DOMxRef("Event")}}.
{{Specifications}}
{{Compat}}