--- title: document.mozFullScreenEnabled slug: Web/API/Document/fullscreenEnabled translation_of: Web/API/Document/fullscreenEnabled original_slug: Web/API/Document/mozFullScreenEnabled ---
{{ ApiRef() }}
返回一个布尔值,表明浏览器是否支持全屏模式. 全屏模式只在那些不包含窗口化的插件的页面中可用.对于一个{{ HTMLElement("iframe") }}元素中的页面,则它必需拥有{{ HTMLAttrXRef("mozallowfullscreen", "iframe") }}属性.
var isFullScreenAvailable = document.mozFullScreenEnabled;
如果当前文档可以进入全屏模式,则isFullScreenAvailable为true
function requestFullScreen() {
if (document.mozFullScreenEnabled) {
videoElement.requestFullScreen();
} else {
console.log('你的浏览器不支持全屏模式!');
}
}
进入页面使用全屏模式查看详情和示例.