Document: fullscreenEnabled プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
fullscreenEnabled
は Document
インターフェイスの読み取り専用プロパティで、全画面モードが使用できるかどうかを示します。
全画面モードは、文書内にウィンドウ化されたプラグインを含まないページ、および文書内のすべての <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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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.
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.