Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

document.mozFullScreenEnabled

概述

返回一个布尔值,表明浏览器是否支持全屏模式. 全屏模式只在那些不包含窗口化的插件的页面中可用.对于一个<iframe>元素中的页面,则它必需拥有mozallowfullscreen属性.

语法

var isFullScreenAvailable = document.mozFullScreenEnabled;

如果当前文档可以进入全屏模式,则isFullScreenAvailabletrue

例子

function requestFullScreen() {
  if (document.mozFullScreenEnabled) {
    videoElement.requestFullScreen();
  } else {
    console.log('你的浏览器不支持全屏模式!');
  }
}

备注

进入页面使用全屏模式查看详情和示例.

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 10.0 (10.0) ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 10.0 (10.0) ? ? ?

规范

该方法在规范草案 https://dvcs.w3.org/hg/fullscrezh-cn/raw-file/tip/Overview.html#dom-document-fullscreenenabled 中被提出.

相关链接

文档标签和贡献者

 此页面的贡献者: teoli, khalid32, ziyunfei
 最后编辑者: khalid32,