The HTML allow attribute
On an <iframe>, the HTML allow attribute grants features to the framed page, as in allow="camera; fullscreen". Entries are separated by semicolons. A feature written without origins is granted only to the origin of the iframe's src URL.
Overview
The HTML allow attribute sets the Permissions Policy of an <iframe>, which decides the features its page may use. Camera and microphone access, geolocation, fullscreen and payment requests are among the features it covers.
A frame from another origin starts without many of them. Fullscreen, the camera, the microphone and geolocation each have a default allowlist of 'self', which reaches only frames from the embedding page's own origin.
Each entry pairs a feature name with an optional allowlist. That list can be * for any origin, 'self' for the embedding page's origin, 'src' for the origin of the iframe's src URL, 'none' to block it, or origins written without quotes. A feature with no list gets 'src'.
Chromium-based browsers also read the Permissions-Policy header, but Firefox and Safari don't support it. The header names the origins a page may hand each listed feature to, and allow grants the feature within that set. Neither can bring back a feature the page has lost.
The header uses geolocation=(self "https://example.com"), with commas between features, while the attribute uses geolocation 'self' https://example.com. The attribute kept the syntax of Feature Policy, the older specification.
Syntax
<iframe src="https://example.com/map" title="Store locations map"
allow="geolocation; fullscreen"></iframe>
Values
| Value |
|---|
Feature names separated by semicolons, each with an optional allowlist, such as camera; fullscreen 'none'. |
Example
<p>Both frames run the same page. Press Fullscreen in each, and again to leave.</p>
<iframe id="open" title="Frame with allow fullscreen *" allow="fullscreen *" width="140" height="76"></iframe>
<iframe id="shut" title="Frame with allow fullscreen 'none'" allow="fullscreen 'none'" width="140" height="76"></iframe>
<p id="msg" role="status">Checking both frames...</p>
<script></script>
Best practices
- List only the features a frame needs in
allow, written as bare names where you can. A bare name stays with the src origin when the frame navigates elsewhere, while*follows it anywhere. - Put single quotes around
'self','src'and'none', but leave origins unquoted. A bare self blocks the feature even in a same-origin frame, and a quoted origin grants nothing. - Separate features with semicolons. With
allow="fullscreen, camera", neither feature is granted, because the browser reads the value as a single entry withfullscreen,as an unknown feature name. - For fullscreen in Safari, add allowfullscreen next to
allow, since desktop versions from 10.1 support only that older attribute for fullscreen. Both frames in the example may read Blocked there.
Frequently asked questions
Why can't a cross-origin iframe use the camera without allow?
getUserMedia() rejects with a NotAllowedError in the frame.






















