spec checked

MDN: Window beforeunload event

Documents the beforeunload event for warning users about impending unsaved data loss, including browser restrictions, sticky activation, mobile reliability limits, and the recommendation to attach listeners only while unsaved changes exist.

Open source

Pattern Decisions This Source Supports

Pattern Supported decision Required contract Claim note
Exit warning Choose exit warning when departure has already been attempted and leaving would lose work or context that is not safely recoverable. The warning appears only after a departure attempt or immediately before a known session boundary that could cause loss. MDN documents beforeunload for preventing unsaved data loss and recommends conditional use.
Unsaved changes prompt Choose unsaved changes prompt when a user action inside the product would abandon or replace dirty local edits before they are saved. Opening the prompt never clears the dirty values. MDN documents warning users about unsaved data loss and limiting listeners to actual unsaved-change conditions.

Evidence Role

This source is treated as spec evidence. Use it to validate the decision rules above, not as a visual style reference.

Publisher: Mozilla. Last checked: .