Contact: [email protected]
This document describes the status of the current implementation of the Permissions-Policy: unload feature in Chrome, and how to enable it.
Starting from version 107, Chrome experimentally supports Permissions-Policy: unload. This allows sites to prevent usage of unload event listeners.
Note that this policy is not available by default. Chrome plans to do an origin trial to evaluate its effectiveness and to allow site authors to give feedback.
A new permission is added, unload
, which defaults to be enabled but when disabled makes calls to window.addEventListener("unload", callback)
a no-op.
The policy can be enabled in several ways.
Pass the --enable-features=PermissionsPolicyUnload
command line flag.
Enable the flag chrome://flags/#enable-experimental-web-platform-features .
The Origin Trial feature is named PermissionsPolicyUnload
. Registration for the trial is here. See feature status to find out if the origin trial is currently running.
The origin trial tutorial describes how to participate.
In devtools, run the following piece of javascript
document.createElement("iframe").allow="unload";
If it succeeds then the feature is enabled. If it gives an error like Unrecognized feature: 'unload'.
then the feature is not enabled.