en-US

Control the behavior for the cancel dialog produced by the beforeunload event (obsolete)

Supported on: Microsoft Edge version 118-130, Windows 7 or later

Registry

HKLM Software\Policies\Microsoft\Edge
HKCU Software\Policies\Microsoft\Edge

Value name: BeforeunloadEventCancelByPreventDefaultEnabled

Enabled: BeforeunloadEventCancelByPreventDefaultEnabled = 1

Disabled: BeforeunloadEventCancelByPreventDefaultEnabled = 0

Description

OBSOLETE: This policy is obsolete and doesn't work after Microsoft Edge 130. This policy provides a temporary opt-out for two related fixes to the behavior of the confirmation dialog that’s shown by the beforeunload event. If you've enabled this policy, the new (correct) behavior is used. If you've disabled this policy, the old (legacy) behavior is used. If you haven't configured this policy, the default behavior is used. Note: This policy is a temporary workaround and is going to be removed in a future release. New and correct behavior: In `beforeunload`, calling `event.preventDefault()` triggers the confirmation dialog. Setting `event.returnValue` to the empty string doesn’t trigger the confirmation dialog. Old and legacy behavior: In `beforeunload`, calling `event.preventDefault()` doesn’t trigger the confirmation dialog. Setting `event.returnValue` to the empty string triggers the confirmation dialog.