Document.fullscreenElement
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.
Syntax
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
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
fullscreenElement |
71
20
|
79
12
12-14
|
64
9
|
11 |
58
15
12.1-15
|
6 |
71
≤37
|
71
25
|
64
9
|
50
14
12.1-14
|
12
Only available on iPad, not on iPhone.
|
10.0
1.5
|
See also
- Fullscreen API
- Guide to the Fullscreen API
Element.requestFullscreen()
Document.exitFullscreen()
-
:fullscreen
and::backdrop
- The
<iframe>
allowfullscreen
attribute
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenElement