W3cubDocs

/DOM

DocumentOrShadowRoot.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

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 53
Prefixed
53
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
64
64
47
Disabled
Disabled From version 47: this feature is behind the full-screen-api.unprefix.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
9
Uses the non-standard name: mozFullScreenElement
Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: ms
40
Prefixed
40
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 53
Prefixed
53
Prefixed
Prefixed Implemented with the vendor prefix: webkit
53
Prefixed
53
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
64
64
47
Disabled
Disabled From version 47: this feature is behind the full-screen-api.unprefix.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
9
Uses the non-standard name: mozFullScreenElement
40
Prefixed
40
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
6.0
Prefixed
6.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit

See also

© 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