Fullscreen API
The fullscreen API makes a specific element fill the whole screen and hides most browser UI. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Overview
The fullscreen API makes a specific element fill the whole screen and hides most browser UI. 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 | |
| 71 | 12 | 64 | 16.4 | 71 | 16.4 | |
| HTML attribute | ||||||
allowfullscreen | 38 | 12 | 18 | 10.1 | 38 | 12 |
| DOM API | ||||||
| The Document method exitFullscreen() requests that the element on this document which is currently being presented in fullscreen mode be taken out of fullscreen mode, restoring the previous state of the screen. This usually reverses the effects of a previous call to Element.requestFullscreen(). | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
exitFullscreen (returns promise) Returns a `Promise` | 69 | 79 | 64 | 16.4 | 69 | 16.4 |
| The fullscreenchange event is fired immediately after the browser switches into or out of fullscreen mode. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The Document.fullscreenElement read-only property returns the that is currently being presented in fullscreen mode in this document, or null if fullscreen mode is not currently in use. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The read-only fullscreenEnabled property on the Document interface indicates whether or not fullscreen mode is available. | 71 | 12 | 64 | 16.4 | 71 | 16.4 |
| The fullscreenerror event is fired when the browser cannot switch to fullscreen mode. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The fullscreenchange event is fired immediately after an Element switches into or out of fullscreen mode. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The fullscreenerror event is fired when the browser cannot switch to fullscreen mode. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The Element.requestFullscreen() method issues an asynchronous request to make the element be displayed in fullscreen mode. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
requestFullscreen (options navigationUI parameter) `options.navigationUI` parameter | 71 | 79 | | 16.4 | 71 | |
requestFullscreen (returns promise) Returns a `Promise` | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| The allowFullscreen property of the HTMLIFrameElement interface is a boolean value that reflects the allowfullscreen attribute of the iframe element, indicating whether to allow the iframe's contents to use Element.requestFullscreen. | 38 | 12 | 22 | 10.1 | 38 | 12 |
| The fullscreenElement read-only property of the ShadowRoot interface returns the element within the shadow tree that is currently displayed in full screen. | 71 | 79 | 64 | 16.4 | 71 | 16.4 |
| CSS selector | ||||||
fullscreen Fullscreen support | 69 | 12 | 47 | 16.4 | 69 | 16.4 |
all elements Select all elements in the fullscreen stack | | 12 | 43 | | | |
| Other | ||||||
html.elements.iframe.allow.fullscreen | 62 | 79 | 80 | | 62 | |
http.headers.Permissions-Policy.fullscreen Experimental The HTTP Permissions-Policy header fullscreen directive controls whether the current document is allowed to use Element.requestFullscreen(). | 88 | 88 | | | 88 | |
- Previously available under a different name: :-webkit-full-screen (15)
- Previously available under a different name: :-moz-full-screen (9)
- Previously available under a different name: :-webkit-full-screen (6)
- Previously available under a different name: :-webkit-full-screen (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Previously available under a different name: :-webkit-full-screen (12)
- This feature was removed in a later browser version (38)
- Available with a vendor prefix: webkit (17)
- This feature was removed in a later browser version (18)
- Available with a vendor prefix: moz (9)
- Available with a vendor prefix: webkit (5.1)
- This feature was removed in a later browser version (38)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (15)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Previously available under a different name: mozCancelFullScreen (9)
- Available with a vendor prefix: webkit (5.1)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (15)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: moz (10)
- Available with a vendor prefix: webkit (5.1)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (20)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Previously available under a different name: mozFullScreenElement (9)
- Available with a vendor prefix: webkit (6)
- Available with a vendor prefix: webkit (25)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (20)
- Previously available under a different name: mozFullScreenEnabled (10)
- Available with a vendor prefix: webkit (6)
- Available with a vendor prefix: webkit (25)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (18)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: moz (10)
- Available with a vendor prefix: webkit (6)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (15)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: moz (10)
- Available with a vendor prefix: webkit (5.1)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (18)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: moz (10)
- Available with a vendor prefix: webkit (6)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Available with a vendor prefix: webkit (12)
- Available with a vendor prefix: webkit (15)
- This feature was removed in a later browser version (14)
- Available with a vendor prefix: webkit (12)
- Previously available under a different name: mozRequestFullScreen (9)
- Before Firefox 44, Firefox incorrectly allowed elements inside a `<frame>` or `<object>` element to request, and to be granted, fullscreen. In Firefox 44 and onwards this has been fixed: only elements in the top-level document or in an `<iframe>` element with the `allowfullscreen` attribute can be displayed fullscreen.
- Available with a vendor prefix: webkit (5.1)
- Available with a vendor prefix: webkit (18)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Only available on iPad, not on iPhone. Shows an overlay button which can not be disabled.
- Available with a vendor prefix: webkit (12)
- This feature was removed in a later browser version (18)
- Previously available under a different name: mozAllowFullScreen (9)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- Previously available under a different name: mozFullScreenElement (63)
- This browser only partially implements this feature
- Only available on iPad, not on iPhone.
- Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
- This feature was removed in a later browser version (79)
Syntax
document.getElementById('video').requestFullscreen();
// Exit fullscreen
document.exitFullscreen();
// Detect fullscreen status
document.addEventListener('fullscreenchange', () => {
console.log('Fullscreen:', !!document.fullscreenElement);
}); Live demo
Request fullscreen
Use requestFullscreen on a container and update status text when the state changes.
Fullscreen support note
Summarize common fullscreen entry points on elements and media.
Presentation checklist
Pair the API with a few operational notes for accessibility and escape handling.
Use cases
Use Fullscreen API
Use Fullscreen API when standard HTML needs a more specific platform feature, semantic signal, or browser capability.
Handle edge cases
Apply Fullscreen API to solve a focused requirement without redesigning the whole page architecture.
Cautions
- Test Fullscreen API 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 Fullscreen API supports the intended task without making the page harder to perceive, understand, or operate.
Related links
Powered by web-features