Web/API/DocumentOrShadowRoot/fullscreenElement

From Get docs


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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
fullscreenElement

Chrome Full support 71


Full support 71


Full support 53

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

Edge Full support ≤79


Full support ≤79


Full support ≤18

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit Full support 12

Prefixed'

Prefixed' Implemented with the vendor prefix: ms

Firefox Full support 64


Full support 64


No support 47 — 65

Disabled'

Disabled' From version 47 until version 65 (exclusive): 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. No support 9 — 65

Alternate Name'

Alternate Name' Uses the non-standard name: mozFullScreenElement

IE Full support Yes

Prefixed'

Full support Yes

Prefixed'

Prefixed' Implemented with the vendor prefix: ms

Opera Full support 40

Prefixed'

Full support 40

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

Safari Full support Yes

Prefixed'

Full support Yes

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

WebView Android Full support 71


Full support 71


Full support 53

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

Chrome Android Full support 71


Full support 71


Full support 53

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

Firefox Android Full support 64


Full support 64


No support 47 — 65

Disabled'

Disabled' From version 47 until version 65 (exclusive): 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. No support 9 — 65

Alternate Name'

Alternate Name' Uses the non-standard name: mozFullScreenElement

Opera Android Full support 41

Prefixed'

Full support 41

Prefixed'

Prefixed' Implemented with the vendor prefix: webkit

Safari iOS Partial support 12

Notes' Alternate Name'

Partial support 12

Notes' Alternate Name'

Notes' Full-screen mode is only supported on the iPad. Alternate Name' Uses the non-standard name: webkitFullscreenElement

Samsung Internet Android Full support 6.0

Prefixed'

Full support 6.0

Prefixed'

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