跳转到主要内容

控制由 beforeunload 事件生成的取消对话框的新行为

  • BeforeunloadEventCancelByPreventDefaultEnabled

已弃用 自 M131 起,此政策已被弃用。此政策为用户提供一个临时选项,用于对 beforeunload 事件所触发的确认对话框的行为停用两个相关的修复项。如果此政策已启用,系统将使用新的正确行为。如果此政策已停用,系统将使用旧行为。如果此政策未设置,系统将使用默认行为。此政策是一种临时的变更方案,很快就会被移除。

新的正确行为:在 beforeunload 中,调用 event.preventDefault() 会触发确认对话框。将 event.returnValue 设为空字符串时不会触发确认对话框。

旧行为:在 beforeunload 中,调用 event.preventDefault() 不会触发确认对话框。将 event.returnValue 设为空字符串时会触发确认对话框。

  • true = 针对 beforeunload 事件调用 event.preventDefault() 时显示取消对话框。当 beforeunload 事件的 event.returnValue 是空字符串时,不显示取消对话框。
  • false = 针对 beforeunload 事件调用 event.preventDefault() 时不显示取消对话框。当 beforeunload 事件的 event.returnValue 是空字符串时,显示取消对话框。
  • 未设置 = 使用功能发布计划的默认行为。

数据类型:

Boolean

支持的功能:

  • 动态政策刷新: True
  • 根据个人资料: True