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
からの返値を調べています。文書が全画面モードで (fullscreenElement
が null
ではなく)、全画面の要素の nodeName
が VIDEO
、すなわち <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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.