document.mozFullScreen

This article is in need of a technical review.

« DOM Reference

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Summary

Reports whether or not the document is currently displaying content in fullscreen mode.

Note that the draft specification of the fullscreen API does not include a document.fullscreen attribute, and instead suggests checking whether document.fullscreenElement is non-null to determine whether the browser is in fullscreen mode. Using document.fullscreenElement to dertermine whether the browser is in fullscreen mode is recommend.

Syntax

var isFullScreen = document.mozFullScreen || document.webkitIsFullScreen;

On return, isFullScreen is true if the document is being displayed in fullscreen mode; otherwise it's false.

Example

function isDocumentInFullScreenMode() {
  // Note that the browser fullscreen (triggered by short keys) might
  // be considered different from content fullscreen when expecting a boolean
  return ((document.fullScreenElement && document.fullScreenElement !== null) ||    // alternative standard methods
      (!document.mozFullScreen && !document.webkitIsFullScreen));                   // current working methods
}

Notes

See Using fullscreen mode for details and examples.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 9.0 (9.0) ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 9.0 (9.0) ? ? ?

Specification

Not part of any specification.

See also

Document Tags and Contributors

Contributors to this page: Sheppy, fscholz, ziyunfei, kscarfone, aams1, ernestd, cpearce, Reachmeatshivam
Last updated by: kscarfone,
Hide Sidebar