Skip to content

Errors / Blocked by the browser

[Violation] Permissions policy violation: unload is not allowed in this document.

A script used an old way to run code when the visitor leaves, which Chrome is phasing out.

Code meant to run when the visitor leaves (saving a draft, sending a last analytics hit) does not run.

Why it happens

  • Chrome is deprecating the unload event and, on more and more sites, disables it through the unload permissions policy.
  • Old analytics, old jQuery plugins and some chat widgets still add unload listeners.

How to fix it

  1. Replace unload with pagehide (or visibilitychange to send analytics).
  2. Update or replace the third-party script that adds it; its file is on the console line.
  3. An unload handler that no longer runs means whatever it did no longer happens: an analytics beacon sent on leaving, a draft saved, a lock released. Check that each of those still reaches its server after the switch. Pages without unload handlers also keep Chrome's back/forward cache, so going back to them is instant.

Whose problem it is

Either the site's own code or a third party's, depending on where it comes from.

Does your site have it?

Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.

Check only sites you run or have permission to check.

Often seen with