Document-Policy Builder & Analyzer
Generate or analyze Document-Policy directives for controlling document behaviors such as unload handlers, sync XHR, and layout performance features. Validates tokens, numeric thresholds, duplicate directives, and explains rollout and browser-support caveats locally.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Building a policy line
Build mode turns a comma-separated directive list into the Document-Policy header value. Every directive must use parenthesized policy syntax, and an empty list or any malformed entry stops the build with a clear error instead of emitting a broken header.
Reading pasted directives
Analyze mode splits the header on commas while keeping quoted values intact, then lists each directive name, its value and a status. It catches invalid tokens, duplicate directives, values that are not parenthesized, and numeric thresholds above 1000 as unusually high.
A sensible moment to use it
Reach for it when auditing a site that already sends Document-Policy, or when drafting an unload or sync-xhr opt-out to try in a staging environment before it reaches production.
Support varies, so test first
Directive semantics and browser support differ, so a header that looks valid here may be ignored or enforced differently elsewhere. Validate the affected code before enforcing a policy, since it can change page behaviour.
Analyzed on-device
Directives are parsed and generated inside the browser. Nothing is uploaded and no network request is made.
Questions
What does Document-Policy control?
It lets a document opt into or restrict browser behaviors and performance-related features, depending on browser support and the directive.
Is it the same as Permissions-Policy?
No. Permissions-Policy governs powerful feature access and delegation; Document-Policy governs document behavior and performance controls.
Should I deploy it immediately?
Roll out carefully, validate browser support, and test affected code because enforcing a policy can change page behavior.
Related tools
See category- Permissions-Policy Builder & Analyzer
- HTTP Security Headers Analyzer
- Cross-Origin-Opener-Policy Builder & Analyzer
- :nth-child An+B Evaluator
Permissions-Policy Builder & Analyzer
Build or inspect browser capability policy directives.
HTTP Security Headers Analyzer
Review pasted HTTP response headers for common browser security protections.
Cross-Origin-Opener-Policy Builder & Analyzer
Build or inspect browsing-context opener isolation.
:nth-child An+B Evaluator
Parse CSS An+B (:nth-child, :nth-of-type) microsyntax, validate it, and list which child indices it matches.