Document: fullscreenElement プロパティ

Limited availability

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

Document.fullscreenElement プロパティは読み取り専用で、この文書内で現在全画面モードで表示されている Element を返し、全画面モードを使用していない場合は null を返します。

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

返値

現在全画面モードになっている Element オブジェクト。全画面モードがこの document で使用されていない場合、返値は null です。

この例は isVideoInFullscreen() 関数を表し、 fullscreenElement からの返値を調べています。文書が全画面モードで (fullscreenElementnull ではなく)、全画面の要素の nodeNameVIDEO、すなわち <video> 要素を表す場合、この関数は true、すなわち動画が全画面モードであることを表します。

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

仕様書

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

ブラウザーの互換性

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.

関連情報