Document: fullscreenEnabled プロパティ

Limited availability

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

fullscreenEnabledDocument インターフェイスの読み取り専用プロパティで、全画面モードが使用できるかどうかを示します。

全画面モードは、文書内にウィンドウ化されたプラグインを含まないページ、および文書内のすべての <iframe> 要素が allowfullscreen 属性を持つページに限り使用することができます。

このプロパティは読み取り専用ですが、変更されても(厳格モードでも)例外を発生させません。セッターは何もしないので、無視されます。

論理値であり、文書や要素が Element.requestFullscreen() を呼び出すことで全画面モードに移行できるのであれば true です。全画面モードが利用できないのであれば、値は false になります。

この例では、 <video> 要素に全画面モードへの移行を試みる前に fullscreenEnabled の値をチェックし、利用できない場合には移行を試みないようにします。

js
function requestFullscreen() {
  if (document.fullscreenEnabled) {
    videoElement.requestFullscreen();
  } else {
    console.log("このブラウザーは全画面モードを使用することができません");
  }
}

仕様書

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

ブラウザーの互換性

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
fullscreenEnabled

Legend

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

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

関連情報