A window’s onbeforeunload property may be set to a function that returns a string. If the function returns a string, then before unloading the page, a dialog is shown to have the user confirm that they indeed want to navigate away. The string provided by the function will no longer be shown in the dialog. Rather, a generic string not under the control of the webpage will be shown.
Final published standard: Recommendation, Living Standard, Candidate Recommendation, or similar final form
Status in Chromium
Consensus & Standardization
Last updated on 2020-11-09