The Document.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.
var element = document.fullscreenElement;
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.
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;
} | Specification | Status | Comment |
|---|---|---|
| Fullscreen API The definition of 'Document.fullscreenElement' in that specification. | Living Standard | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 53
|
Yes
|
64
|
Yes
|
40
|
Yes
|
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 53
|
53
|
Yes
|
64
|
40
|
Yes
|
6.0
|
Element.requestFullscreen()Document.exitFullscreen():fullscreen and ::backdrop
<iframe> allowfullscreen attribute
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/fullscreenElement