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

Prathamesh Shende 531 Reputation points
2026-08-15T03:54:07.5666667+00:00

Hello,
I am getting this error after migrating from .net 8 to .net 10 blazor web app project. server and webassembly rendermode
"[Violation] Permissions policy violation: unload is not allowed in this document." in browser console.

how to resolve this?

Developer technologies | .NET | Blazor

Answer accepted by question author
Danny Nguyen (WICLOUD CORPORATION) 8,195 Reputation points Microsoft External Staff Moderator
2026-08-17T04:37:53.42+00:00

Hello @Prathamesh Shende ,

To address your concern regarding how to handle this when using third-party libraries: it makes sense that this error can suddenly appear, as modern Chromium-based browsers (like Chrome and Edge) are rolling out strict deprecations for the unload event across their updates to improve page performance and Back/Forward Cache capabilities.

When the unload event violation originates from a third-party library (like Bootstrap or Google Analytics) that you cannot easily modify yourself, you have a couple of options:

1. Wait for Library Updates Most major libraries (including Bootstrap) are actively removing unload listeners in newer versions because of this exact browser policy change. Upgrading your NPM/NuGet packages or updating CDN links to their latest versions is the best long-term solution.

2. Temporary Server-Side Workaround If you cannot update the library immediately and want to suppress the violation, you can explicitly grant the unload permission using the Permissions-Policy HTTP header.

You can add this middleware in your Program.cs file in your Blazor project (ensure this runs early in the pipeline):

app.Use(async (context, next) =>
{
    context.Response.Headers.Append("Permissions-Policy", "unload=*");
    await next();
});

Note: Use this workaround cautiously. Browsers are moving towards completely ignoring the unload event in the future, so relying on this header is only a temporary fix.

3. Check for specific problematic scripts You mentioned you saw this in your browser console. If you inspect the [Violation] entry in the Developer Tools (F12), there is usually a file link on the right side of the error message. Looking at that file can help you pinpoint exactly which third-party script triggers it, letting you check their GitHub issues to see if a formal fix is already released.


I hope this helps clarify how to handle third-party libraries. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.

Thank you.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 8,195 Reputation points Microsoft External Staff Moderator
    2026-08-17T02:16:41.8833333+00:00

    I'm looking into this post and will get back to you soon. Thank you for your patience.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.