Permissions-Policy: fullscreen directive
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
The HTTPPermissions-Policy headerfullscreen directive controls whether the current document is allowed to useElement.requestFullscreen().
By default, top-level documents and their same-origin child frames can request and enter fullscreen mode. This directive allows or prevents cross-origin frames from using fullscreen mode. This includes same-origin frames.
Specifically, where a defined policy blocks use of this feature,requestFullscreen() calls will return aPromise that rejects with aTypeError.
Note:If both this directive (i.e., via theallow attribute) and theallowfullscreen attribute are present on an<iframe> element, this directive takes precedence.
In this article
Syntax
Permissions-Policy: fullscreen=<allowlist>;<allowlist>A list of origins for which permission is granted to use the feature. See
Permissions-Policy> Syntax for more details.
Default policy
The default allowlist forfullscreen isself.
Examples
>General example
SecureCorp Inc. wants to disable the Fullscreen API within all browsing contexts except for its own origin and those whose origin ishttps://example.com. It can do so by delivering the following HTTP response header to define a Permissions Policy:
Permissions-Policy: fullscreen=(self "https://example.com")With an <iframe> element
FastCorp Inc. wants to disablefullscreen for all cross-origin child frames, except for a specific<iframe>. It can do so by delivering the following HTTP response header to define a Permissions Policy:
Permissions-Policy: fullscreen=(self)Then include anallow attribute on the<iframe> element:
<iframe src="https://other.com/videoplayer" allow="fullscreen"></iframe>iframe attributes can selectively enable features in certain frames, and not in others, even if those frames contain documents from the same origin.
Specifications
| Specification |
|---|
| Fullscreen API> # permissions-policy-integration> |