Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

allow — features available inside an iframe

The `allow` attribute on `iframe` restricts or delegates browser features through Permissions Policy; it does not grant user consent.

Version: HTML Living Standard

Syntax

<iframe allow="geolocation 'none'; camera 'none'"></iframe>

Its value contains semicolon-separated directives, for example geolocation 'none'; camera 'none'. Each names a feature and an origin allowlist; 'none' denies the feature. This grammar differs from the Permissions-Policy HTTP header. It is not a list of HTML elements.

A frame cannot gain a feature denied by an ancestor document’s policy. Actual use can additionally require a secure context, user activation, or permission. allow does not replace sandbox or remove cross-origin access restrictions.

The example loads only local srcdoc and reads the effective policy using featurePolicy, available in the tested Chromium. Geolocation and camera are denied. No sensors or permission prompts run; this diagnostic interface is not a portable API across all browsers.

Examples

<!doctype html><meta charset="utf-8">
<iframe id="frame" title="Restricted content" allow="geolocation 'none'; camera 'none'"
  srcdoc="<p>Local content</p>"></iframe>
<output id="result"></output>
<script>
document.querySelector('#frame').addEventListener('load', event => {
  const policy = event.target.contentDocument.featurePolicy;
  document.querySelector('#result').textContent =
    'geolocation=' + policy.allowsFeature('geolocation') +
    '; camera=' + policy.allowsFeature('camera');
});
</script>

Result

geolocation=false; camera=false

The result comes from the document policy inside the frame, not merely from reading the attribute string.

Sources