Limited supportUse with care and provide a fallback when broad support matters.

Overview

The Feature-Policy response header sets whether a policy-controlled feature, such as an API, may be used in a document. Not to be confused with permissions policy. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
FeaturePolicy
Experimental
74
79
65
74
featurePolicy
Experimental

The featurePolicy read-only property of the Document interface returns the FeaturePolicy interface which provides a simple API for inspecting the Permissions Policies applied to a specific document.

74
79
69
74
allowedFeatures
Experimental

The allowedFeatures() method of the FeaturePolicy interface returns a list of directive names of all features allowed by the Permissions Policy. This enables introspection of individual directives of the Permissions Policy it is run on. As such, allowedFeatures() method returns a subset of directives returned by FeaturePolicy.features.

74
79
65
74
allowsFeature
Experimental

The allowsFeature() method of the FeaturePolicy interface enables introspection of individual directives of the Permissions Policy it is run on. It returns a Boolean that is true if and only if the specified feature is allowed in the specified context (or the default context if no context is specified).

74
79
65
74
features
Experimental

The features() method of the FeaturePolicy interface returns a list of names of all features supported by the User Agent. Feature whose name appears on the list might not be allowed by the Permissions Policy of the current execution context and/or might not be accessible because of user's permissions.

74
79
70
74

The getAllowlistForFeature() method of the FeaturePolicy interface enables querying of the allowlist for a specific feature for the current Permissions Policy.

74
79
65
74
featurePolicy
Experimental

The featurePolicy read-only property of the HTMLIFrameElement interface returns the FeaturePolicy interface which provides a simple API for introspecting the Permissions Policies applied to a specific frame.

74
79
69
74
Other
http.headers.Feature-Policy
Deprecated
60
79
60

The HTTP Permissions-Policy header accelerometer directive controls whether the current document is allowed to gather information about the acceleration of the device through the Accelerometer interface.

66
79
66

The HTTP Permissions-Policy header ambient-light-sensor directive controls whether the current document is allowed to gather information about the amount of light in the environment around the device through the AmbientLightSensor interface.

66
79
66

The HTTP Permissions-Policy header attribution-reporting directive controls whether the current document is allowed to use the Attribution Reporting API.

117
117
117

The HTTP Permissions-Policy header autoplay directive controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface.

64
79
64

The HTTP Permissions-Policy header bluetooth directive controls whether the current document is allowed to use the Web Bluetooth API.

104
104
104

The HTTP Permissions-Policy header browsing-topics directive controls access to the Topics API.

115
115
115

The HTTP Permissions-Policy header camera directive controls whether the current document is allowed to use video input devices.

64
79
64

The HTTP Permissions-Policy header compute-pressure directive controls access to the Compute Pressure API.

125
125

The HTTP Permissions-Policy header cross-origin-isolated directive controls whether the current document is allowed to use APIs that require Window.crossOriginIsolated.

87
87
87

The deferred-fetch Permissions-Policy directive is part of the Fetch API.

135
135
135

The deferred-fetch-minimal Permissions-Policy directive is part of the Fetch API.

135
135
135

The HTTP Permissions-Policy header display-capture directive controls whether or not the document is permitted to use Screen Capture API, that is, MediaDevices.getDisplayMedia to capture the screen's contents.

94
94
94

The HTTP Permissions-Policy response header provides a mechanism to allow and deny the use of browser features in a document or within any iframe elements in the document.

64
79

The HTTP Permissions-Policy header encrypted-media directive controls whether the current document is allowed to use the Encrypted Media Extensions API (EME).

64
79
64

The HTTP Permissions-Policy header fullscreen directive controls whether the current document is allowed to use Element.requestFullscreen().

62
79
62

The HTTP Permissions-Policy header geolocation directive controls whether the current document is allowed to use the Geolocation Interface.

64
79
64

The HTTP Permissions-Policy header gyroscope directive controls whether the current document is allowed to gather information about the orientation of the device through the Gyroscope interface.

66
79
66

The HTTP Permissions-Policy header hid directive controls whether the current document is allowed to use the WebHID API to connect to uncommon or exotic human interface devices such as alternative keyboards or gamepads.

89
89

The HTTP Permissions-Policy header identity-credentials-get directive controls whether the current document is allowed to use the Federated Credential Management API (FedCM), and more specifically usage of the following methods:

110
110
110

The HTTP Permissions-Policy header idle-detection directive controls whether the current document is allowed to use the Idle Detection API to detect when users are interacting with their devices, for example to report "available"/"away" status in chat applications.

94
94
94

The HTTP Permissions-Policy header local-fonts directive controls whether the current document is allowed to gather data on the user's locally-installed fonts via the Window.queryLocalFonts() method.

103
103

The HTTP Permissions-Policy header magnetometer directive controls whether the current document is allowed to gather information about the orientation of the device through the Magnetometer interface.

66
79
66

The HTTP Permissions-Policy header microphone directive controls whether the current document is allowed to use audio input devices.

64
79
64

The HTTP Permissions-Policy header midi directive controls whether the current document is allowed to use the Web MIDI API.

64
79
64

The HTTP Permissions-Policy header otp-credentials directive controls whether the current document is allowed to use the WebOTP API to request a one-time password (OTP) from a specially-formatted SMS message sent by the app's server, i.e., via {{domxref("CredentialsContainer.get", "navigator.credentials.get({otp: ..., ...})")}}.

93
93
84

The HTTP Permissions-Policy header field's payment directive controls whether the current document is allowed to use the Payment Request API.

60
79
60

The HTTP Permissions-Policy header picture-in-picture directive controls whether the current document is allowed to play a video in a Picture-in-Picture API mode.

69
79
105

The HTTP Permissions-Policy header publickey-credentials-create directive controls whether the current document is allowed to use the Web Authentication API to create new WebAuthn credentials, i.e., via {{domxref("CredentialsContainer.create","navigator.credentials.create({publicKey})")}}.

84
84
84

The HTTP Permissions-Policy header publickey-credentials-get directive controls whether the current document is allowed to access the Web Authentication API to retrieve public-key credentials, i.e., via {{domxref("CredentialsContainer.get","navigator.credentials.get({publicKey})")}}.

84
84
84

The HTTP Permissions-Policy header screen-wake-lock directive controls whether the current document is allowed to use Screen Wake Lock API to indicate that the device should not dim or turn off the screen.

84
84
84

The HTTP Permissions-Policy header serial directive controls whether the current document is allowed to use the Web Serial API to communicate with serial devices, either directly connected via a serial port, or via USB or Bluetooth devices emulating a serial port.

89
89
89

The HTTP Permissions-Policy header storage-access directive controls whether a document loaded in a third-party context (i.e., embedded in an iframe) is allowed to use the Storage Access API to request access to unpartitioned cookies.

113
113
113

The HTTP Permissions-Policy header usb directive controls whether the current document is allowed to use the WebUSB API.

60
79
60

The HTTP Permissions-Policy header web-share directive controls whether the current document is allowed to use the Navigator.share method of the Web Share API to share text, links, images, and other content to arbitrary destinations of the user's choice.

86
86
86
http.headers.Feature-Policy.wildcards
Deprecated

Wildcards in allowlist origins

108
108
108

The HTTP Permissions-Policy header window-management directive controls whether or not the current document is allowed to use the Window Management API to manage windows on multiple displays.

100
100
100

The HTTP Permissions-Policy header xr-spatial-tracking directive controls whether the current document is allowed to use the WebXR Device API.

79
79
79
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled

Syntax

HTML
<!-- iframeでのFeature Policy -->
<iframe src="https://example.com"
  allow="camera 'none'; microphone 'none'; geolocation 'self'">
</iframe>

Live demo

Policy idea

Summarize the older feature policy model that limited powerful APIs in embedded content.

PreviewFullscreen

Permissions Policy successor

Explain that Feature Policy evolved into the newer Permissions Policy model.

PreviewFullscreen

Migration note

Prefer the current policy model when designing new embeds or security boundaries.

PreviewFullscreen

Use cases

  • Use Feature policy

    Use Feature policy when standard HTML needs a more specific platform feature, semantic signal, or browser capability.

  • Handle edge cases

    Apply Feature policy to solve a focused requirement without redesigning the whole page architecture.

Cautions

  • Test Feature policy in your target browsers and input environments before depending on it as a primary behavior.
  • Provide a fallback path or acceptable degradation strategy when support is still limited.

Accessibility

  • Make sure Feature policy supports the intended task without making the page harder to perceive, understand, or operate.

Powered by web-features