Edit

Share via


BeforeunloadEventCancelByPreventDefaultEnabled

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

OBSOLETE: This policy is obsolete and doesn't work after Microsoft Edge version 130.

Supported versions

  • On Windows and macOS since 118, until 130

Description

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.

When this policy is Enabled, the new (correct) behavior will be used. When this policy is Disabled, the old (legacy) behavior will be used. When this policy is left not set, the default behavior will be used. Note: This policy is a temporary workaround and will be removed in a future release.

New and correct behavior: In beforeunload, calling event.preventDefault() will trigger the confirmation dialog. Setting event.returnValue to the empty string won’t trigger the confirmation dialog.

Old and legacy behavior: In beforeunload, calling event.preventDefault() won’t trigger the confirmation dialog. Setting event.returnValue to the empty string will trigger the confirmation dialog.

Supported features

  • Can be mandatory: Yes
  • Can be recommended: No
  • Dynamic Policy Refresh: Yes
  • Per Profile: Yes
  • Applies to a profile that is signed in with a Microsoft account: No

Data type

  • Boolean

Windows information and settings

Group Policy (ADMX) info

  • GP unique name: BeforeunloadEventCancelByPreventDefaultEnabled
  • GP name: Control the behavior for the cancel dialog produced by the beforeunload event (obsolete)
  • GP path (Mandatory): Administrative Templates/Microsoft Edge
  • GP path (Recommended): N/A
  • GP ADMX file name: MSEdge.admx

Example value

Enabled

Registry settings

  • Path (Mandatory): SOFTWARE\Policies\Microsoft\Edge
  • Path (Recommended): N/A
  • Value name: BeforeunloadEventCancelByPreventDefaultEnabled
  • Value type: REG_DWORD

Example registry value

0x00000001

Mac information and settings

  • Preference Key name: BeforeunloadEventCancelByPreventDefaultEnabled
  • Example value:
<true/>

See also