HTTP response guides

Read a Permissions-Policy header before changing an iframe

·

When a feature works in a top-level page and fails in an iframe, start by checking the actual response’s declared allowlists. Then compare the frame’s origin and ancestor policies before changing the header.

Permissions-Policy Checker

Read the recorded allowlists in the example

Load example and select Check Permissions-Policy. Camera has an empty allowlist. Geolocation lists self and https://maps.example.test. Inspect these as header declarations for a browser that supports the named features.

Fullscreen appears twice across the two fields. Its first wildcard declaration is marked replaced. The latest declaration says same origin. The microphone row has an empty allowlist and a report-to token of permissions.

Remove fullscreen=(self) from the second field, including its following comma, and check again. Fullscreen now has one declaration and its allowlist reads Any origin.

W3C Permissions Policy structured header delivery and processingRFC 8941 structured dictionary parser

Compare the frame origin with the declaration

Check the frame URL’s scheme, host and port. A site under the same parent domain can have a different origin. For an explicit origin or self declaration, compare those values with the response document and the frame.

Check the iframe allow attribute and restrictions inherited from enclosing frames. Features can have defaults when omitted from the header, and browser support can vary. API-specific checks and user approval can still apply.

W3C Permissions Policy structured header delivery and processing

Recognize a malformed policy dictionary

Try camera=(self, "https://maps.example.test"). The comma is invalid inside this inner list and the tool reports a dictionary error. Separate allowlist entries with spaces. Commas separate the top-level dictionary members.

Download the valid report to retain the original declaration order, repeated entries and reporting token. Confirm the actual observed header in the desired response. An iframe allow attribute and the older Feature-Policy header have different syntax.

W3C Permissions Policy structured header delivery and processingRFC 8941 structured dictionary parser

Common questions

What does self mean in the response field?

In an allowlist, the self token refers to the origin of the document supplying the header. Quoted origins add explicitly listed sources.

Does the report-to token send a report?

The checker displays the endpoint name in the declaration. Actual policy reporting depends on the browser, the response and its reporting endpoint configuration.

Sources

Put it into practice.

Related guides