Document: fullscreenElement property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The Document.fullscreenElement read-only property returns the Element that is currently being presented in fullscreen mode in this document, or null if fullscreen 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.

Value

The Element object that's currently in fullscreen mode; if fullscreen mode isn't currently in use by the document, the returned value is null.

Examples

This example presents a function, isVideoInFullscreen(), which looks at the value returned by fullscreenElement; if the document is in fullscreen mode (fullscreenElement isn't null) and the fullscreen element's nodeName is VIDEO, indicating a <video> element, the function returns true, indicating that the video is in fullscreen mode.

js
function isVideoInFullscreen() {
  if (document.fullscreenElement?.nodeName === "VIDEO") {
    return true;
  }
  return false;
}

Specifications

Specification
Fullscreen API
# ref-for-dom-document-fullscreenelement①

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
fullscreenElement

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also