Permissions-Policy: switching off browser features you never use
This Permissions-Policy generator builds the header that disables camera, microphone, geolocation, sensors and 20+ other browser features — across your own pages and every iframe you embed. Below: the syntax that trips people up, and why an unlisted feature is not a blocked one.
What the header does
Permissions-Policy declares which powerful browser APIs are available in a document. It is not a permission prompt and it does not ask the user anything — it decides whether the question can be asked at all.
The reason it matters more than it first appears is iframes. By default, an embedded third-party frame inherits your document's ability to request the camera, the microphone or precise location. The resulting prompt names your domain, because permissions are granted per top-level site. An advert or chat widget can therefore trigger a permission request that users will attribute to you.
Switching off features you never use removes that possibility completely, at the cost of one header.
The syntax, and the three ways to get it wrong
| Form | Meaning | Correct? |
|---|---|---|
camera=() | Blocked everywhere. | Yes |
camera=(self) | Your origin only. | Yes — self is unquoted |
camera=* | Every origin, including all frames. | Yes, but rarely wise |
camera=(self "https://a.com") | Your origin plus a named one. | Yes — origins are quoted |
camera=(self https://a.com) | Unquoted origin. | No — invalid |
camera 'none'; mic 'none' | Old Feature-Policy grammar. | No — wrong header |
camera=(), mic=() | Comma-separated features. | Yes — commas, not semicolons |
self is a bare keyword and must not be quoted; origins are strings and must be. Get it backwards and the entry is invalid — with no error message anywhere.An unlisted feature is not blocked
This is the misconception that makes a policy weaker than intended. Omitting a feature does not disable it; it falls back to the browser default, and for most features that default is self — allowed on your own origin.
So a header naming three features has locked down three features and left the other two dozen at their defaults. If the goal is "this site never uses hardware APIs", every one of them has to be named. That is why the generated header is long: completeness is the entire point.
The compensating detail is that browsers ignore feature names they do not recognise. Listing a feature your target browser has never heard of is harmless — which makes an exhaustive list safe to ship.
What to block on an ordinary site
Always block
Camera, microphone, screen capture, geolocation, USB, serial, HID, Bluetooth, MIDI, idle detection. A blog or brochure site uses none of them, and each is a meaningful capability.
Usually block
Accelerometer, gyroscope, magnetometer, ambient light, local fonts, Topics API. Sensors are a fingerprinting surface as much as a feature.
Often keep
Fullscreen and picture-in-picture, for video. Web Share, for mobile sharing. Autoplay, if you host video.
Keep if relevant
Payment Request and WebAuthn on a checkout or login flow — restricted to self, never *.
Delegating to an iframe
Blocking at the top level blocks everywhere. To let one specific embed use a feature, allow it in the header and then delegate it to that frame with the allow attribute:
<iframe src="https://player.example.com" allow="fullscreen; picture-in-picture">
Two rules govern this and both are absolute. A frame can never be granted more than the parent document holds — delegation narrows, it never widens. And the attribute uses its own grammar: semicolon-separated, no parentheses, with 'self' quoted, unlike in the header.
fullscreen and perhaps picture-in-picture; it does not need camera. The allow attribute is the right place to be specific, because it applies to exactly one frame rather than the whole document.Feature-Policy is obsolete
Feature-Policy was the original header and used a different grammar entirely: semicolon-separated, with quoted keywords such as geolocation 'self'. It has been superseded by Permissions-Policy, which every current browser supports.
Do not send both. Two headers expressing overlapping rules in incompatible grammars is a reliable source of confusion during an incident, and the old one buys you nothing on any browser still receiving security updates.
Most stale examples online are in the old syntax. If a snippet uses semicolons between features and quotes around self, it is for the wrong header.
Related security headers
- Content Security Policy Generator — the header that stops XSS.
- Referrer Policy Generator — control what leaks in the Referer header.
- security.txt Generator — publish a disclosure contact.
- X-Robots-Tag Generator — indexing headers for files.
- Nginx Redirect Generator — server config for the same stack.