The DocumentOrShadowRoot.fullscreenElement read-only property returns the Element that is currently being presented in full-screen mode in this document, or null if full-screen mode is not currently in use.
Although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored.
Syntax
var element = document.fullscreenElement;
Return value
The Element object that's currently in full-screen mode; if full-screen mode isn't currently in use by the document>, the returned value is null.
Example
This example presents a function, isVideoInFullscreen(), which looks at the value returned by fullscreenElement; if the document is in full-screen mode (fullscreenElement isn't null) and the full-screen element's nodeName is VIDEO, indicating a <video> element, the function returns true, indicating that the video is in full-screen mode.
function isVideoInFullscreen() {
if (document.fullscreenElement && document.fullscreenElement.nodeName == 'VIDEO') {
return true;
}
return false;
}
Specifications
| Specification | Status | Comment |
|---|---|---|
| Fullscreen API The definition of 'Document.fullscreenElement' in that specification. |
Living Standard | Initial definition |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
fullscreenElement | Chrome
Full support
53
| Edge
Full support
≤18
| Firefox
Full support
64
| IE
Full support
Yes
| Opera
Full support
40
| Safari
Full support
Yes
| WebView Android
Full support
53
| Chrome Android
Full support
53
| Firefox Android
Full support
64
| Opera Android
Full support
41
| Safari iOS
Partial support
12
| Samsung Internet Android
Full support
6.0
|
Legend
- Full support
- Full support
- Partial support
- Partial support
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.
- Uses a non-standard name.
- Uses a non-standard name.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.
