Permissions Policy and iframe allow
HTTP header and iframe allow attribute that decide which features a page or frame may use.
In one line
Can turn features off for itself and its embedded frames
HTTP header and iframe allow attribute that decide which features a page or frame may use.
Lets a site disable features for itself and its iframes. MDN lists 51 directives; each can be self, a list of origins, or none. A feature blocked here never reaches the user prompt.
What it can and can't do
What the user does: Nothing. The site sets rules in its headers or in an iframe
It can
- Block features like camera, location, or microphone for itself
- Allow a feature in an iframe only if both sides agree
- Stop embedded ads or widgets from using sensors
- Set 51 or so rules, each for self, listed sites, or none
It cannot
- Give itself more than you allow in the browser
- Turn on a feature you blocked
- Let an embedded frame use a feature the parent blocked
- Skip your pop up for a feature
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 88 | 2021-01-19 | None |
| Edge | Supported | 88 | 2021-01-21 | None |
| Firefox | Supported | 74 | 2020-03-10 | None |
| Safari | Supported | 11.1 | 2018-04-12 | None |
| Safari on iPhone | Supported | 11.3 | 2018-03-29 | None |
| Chrome on Android | Supported | 88 | 2021-01-19 | None |
| Samsung Internet | Supported | 12.0 | 2020-06-19 | None |
How a site asks for it
| API | Permissions-Policy: geolocation=(self); <iframe allow="camera; microphone">; document.featurePolicy |
| How access is granted | none |
| What the user sees | Server sent header plus iframe allow attribute; cross-origin frames get a feature only if both parent and frame allow it. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Per document |
| How to take it back | Change header or allow |
| Inside an iframe | Controls iframe delegation |
Typical flow
- Server sets Permissions-Policy header
- Embedder sets allow on iframe
- Browser intersects the policy
- Feature granted to frame or blocked
Data you get
What comes back: Feature policy decisions
Shape: list
How often: per document load
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
directives | integer | count | 51 listed on MDN | n/a |
Technical limits
- Camera, microphone, geolocation default to self
- Directive names vary per browser
- Cannot grant what the user denied
The story
What it is
A site rule that says which features the page and its embedded frames are allowed to use.
For you
You never see it. Its job is to protect you: a site can promise that an embedded ad or video cannot reach your camera or location. If a site forgets, an embed might not work.
For makers
Sites use it to lock off powerful features from third party frames, such as ads or widgets. It lowers the damage if an embed is hacked. Embedding services must also ask for the access they need through the allow attribute.
Where you see it
| Type | Example | Apps |
|---|---|---|
| video | A site embeds a video meeting in a frame and allows camera and microphone only for that frame. | Zoom Web SDK |
| ads | A publisher blocks geolocation and camera for all ad frames so ads cannot reach them. | None named |
| games | A game portal allows fullscreen and gamepad access only to the game frame. | itch.io |
| payments | A shop allows the payment request feature only for its payment provider frame. | Stripe |
| security | A bank turns off camera, microphone and location for its own pages. | None named |
| developer | A team tests that a third party widget breaks cleanly when a feature is blocked. | None named |
| enterprise | A company web portal blocks sensors for all embedded dashboards. | None named |
Risks
- If misconfigured, embeds break
- Only as safe as the site makes it
What the platform says
- MDN: Permissions Policy. Docs explain it as a header that lets sites turn browser features on or off for themselves and embeds.
- Google: Permissions Policy. Chrome documents how to control feature access for your page and third party frames.
Good uses and abuse
Legitimate uses
- Locking down embeds
Known abuse
- None direct, but misconfiguration over-delegates
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 5 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2018-07, Chrome 60: Feature-Policy header ships
- 2020-07, Chrome 88: Permissions-Policy replaces Feature-Policy
Related capabilities
Related
- Permissions API. Can check whether you allowed or blocked a feature, without asking you
Sources
How well checked: Checked against real behavior.