Nossos voluntários ainda não traduziram este artigo para o Português (do Brasil). Junte-se a nós e ajude-nos a fazer o trabalho!
Você também pode ler o artigo em English (US).

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HTTP Feature-Policy header  provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds.

For more information, see the main Feature Policy article.

Header type Response header
Forbidden header name yes

Syntax

Feature-Policy: <directive> <allowlist>
<allowlist>

The allowlist is a list of origins that takes one of the following values:

  • *: The feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes).
  • 'self': (Default) The feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. The feature is not allowed in cross-origin documents in nested browsing contexts.
  • 'none': The feature is disabled in top-level and nested browsing contexts.
  • <origin(s)>: The feature is allowed for specific origins (for example, https://example.com). Origins should be separated by a space.

The values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' may be used with one or more origins.

Directives

fullscreen
Controls whether the current document is allowed to use Element.requestFullScreen(). When this policy is enabled, the returned Promise rejects with a TypeError.
geolocation
Controls whether the current document is allowed to use the Geolocation Interface. When this policy is enabled, calls to getCurrentPosition() and watchPosition() will cause those functions' callbacks to be invoked with a PositionError code of PERMISSION_DENIED.
microphone
Controls whether the current document is allowed to use audio input devices. When this policy is enabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError.

Example

SecureCorp Inc. wants to disable Vibration and Geolocation APIs in their application. It can do so by delivering the following HTTP response header to define a feature policy:

Feature-Policy: vibrate 'none'; geolocation 'none'

By specifying the 'none' keyword for the origin list, the specified features will be disabled for all browsing contexts, regardless of their origin.

Specifications

Specification Status Comment
Feature Policy
The definition of 'Feature-Policy' in that specification.
Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support 60Edge No support NoFirefox No support NoIE No support NoOpera Full support 47Safari No support NoWebView Android Full support 60Chrome Android Full support 60Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 47Safari iOS No support NoSamsung Internet Android No support No
accelerometer
Experimental
Chrome Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
ambient-light-sensor
Experimental
Chrome Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
animations
Experimental
Chrome Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
autoplay
Experimental
Chrome Full support 64Edge No support NoFirefox No support NoIE No support NoOpera Full support 51Safari No support NoWebView Android Full support 64Chrome Android Full support 64Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 51Safari iOS No support NoSamsung Internet Android No support No
camera
Experimental
Chrome Full support 59Edge No support NoFirefox No support NoIE No support NoOpera Full support 48Safari No support NoWebView Android Full support 59Chrome Android Full support 59Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 48Safari iOS No support NoSamsung Internet Android No support No
encrypted-media
Experimental
Chrome Full support 59Edge No support NoFirefox No support NoIE No support NoOpera Full support 48Safari No support NoWebView Android Full support 59Chrome Android Full support 59Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 48Safari iOS No support NoSamsung Internet Android No support No
fullscreen
Experimental
Chrome Full support 57Edge No support NoFirefox No support NoIE No support NoOpera Full support 46Safari No support NoWebView Android Full support 57Chrome Android Full support 57Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 46Safari iOS No support NoSamsung Internet Android No support No
geolocation
Experimental
Chrome Full support 56Edge No support NoFirefox No support NoIE No support NoOpera Full support 45Safari No support NoWebView Android Full support 56Chrome Android Full support 56Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 45Safari iOS No support NoSamsung Internet Android No support No
gyroscope
Experimental
Chrome Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
legacy-image-formats
Experimental
Chrome Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
magnetometer
Experimental
Chrome Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
maximum-downscaling-image
Experimental
Chrome Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 68
Disabled
Full support 68
Disabled
Disabled From version 68: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 55
Disabled
Full support 55
Disabled
Disabled From version 55: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
microphone
Experimental
Chrome Full support 59Edge No support NoFirefox No support NoIE No support NoOpera Full support 48Safari No support NoWebView Android Full support 59Chrome Android Full support 59Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 48Safari iOS No support NoSamsung Internet Android No support No
midi
Experimental
Chrome Full support 56Edge No support NoFirefox No support NoIE No support NoOpera Full support 45Safari No support NoWebView Android Full support 56Chrome Android Full support 56Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 45Safari iOS No support NoSamsung Internet Android No support No
payment
Experimental
Chrome Full support 56Edge No support NoFirefox No support NoIE No support NoOpera Full support 45Safari No support NoWebView Android Full support 56Chrome Android Full support 56Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 45Safari iOS No support NoSamsung Internet Android No support No
picture-in-picture
Experimental
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
speaker
Experimental
Chrome Full support 59Edge No support NoFirefox No support NoIE No support NoOpera Full support 48Safari No support NoWebView Android Full support 59Chrome Android Full support 59Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 48Safari iOS No support NoSamsung Internet Android No support No
sync-xhr
Experimental
Chrome Full support 65
Disabled
Full support 65
Disabled
Disabled From version 65: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 52
Disabled
Full support 52
Disabled
Disabled From version 52: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 65
Disabled
Full support 65
Disabled
Disabled From version 65: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 65
Disabled
Full support 65
Disabled
Disabled From version 65: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 52
Disabled
Full support 52
Disabled
Disabled From version 52: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
unsized-media
Experimental
Chrome Full support 66
Disabled
Full support 66
Disabled
Disabled From version 66: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 53
Disabled
Full support 53
Disabled
Disabled From version 53: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 66
Disabled
Full support 66
Disabled
Disabled From version 66: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Chrome Android Full support 66
Disabled
Full support 66
Disabled
Disabled From version 66: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 53
Disabled
Full support 53
Disabled
Disabled From version 53: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android No support No
usb
Experimental
Chrome Full support 60Edge No support NoFirefox No support NoIE No support NoOpera Full support 47Safari No support NoWebView Android Full support 60Chrome Android Full support 60Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 47Safari iOS No support NoSamsung Internet Android No support No
vibrate
Experimental
Chrome Full support 56Edge No support NoFirefox No support NoIE No support NoOpera Full support 43Safari No support NoWebView Android Full support 56Chrome Android Full support 56Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 43Safari iOS No support NoSamsung Internet Android No support No
vr
Experimental
Chrome Full support 62Edge No support NoFirefox No support NoIE No support NoOpera Full support 49Safari No support NoWebView Android Full support 62Chrome Android Full support 62Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 49Safari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
User must explicitly enable this feature.

Etiquetas do documento e colaboradores

Colaboradores desta página: Malvoz, mfuji09, jpmedley
Última atualização por: Malvoz,