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 APIThe definition of 'Document.fullscreenElement' in that specification. | Living Standard | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
fullscreenElement
|
Chrome Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Edge Full support ≤79 Full support ≤79 Full support ≤18 Prefixed' Implemented with the vendor prefix: webkit Full support 12 Prefixed' Implemented with the vendor prefix: ms |
Firefox Full support 64 Full support 64 No support 47 — 65 Disabled' From version 47 until version 65 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
IE Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: ms |
Opera Full support 40 Full support 40 Prefixed' Implemented with the vendor prefix: webkit |
Safari Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
WebView Android Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Chrome Android Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android Full support 64 Full support 64 No support 47 — 65 Disabled' From version 47 until version 65 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Opera Android Full support 41 Full support 41 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS Partial support 12 Partial support 12 Notes' Full-screen mode is only supported on the iPad.
Alternate Name' Uses the non-standard name: |
Samsung Internet Android Full support 6.0 Full support 6.0 Prefixed' Implemented with the vendor prefix: webkit |
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.
See also
- Fullscreen API
- Guide to the Fullscreen API
Element.requestFullscreen()
Document.exitFullscreen()
:fullscreen
and::backdrop
- The
<iframe>
allowfullscreen
attribute
DocumentOrShadowRoot.fullscreenElement by Mozilla Contributors is licensed under CC-BY-SA 2.5.