document.mozFullScreenEnabled

概述

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

语法

var isFullScreenAvailable = document.mozFullScreenEnabled;

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

例子

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

备注

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

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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) ? ? ?

规范

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

相关链接

文档标签和贡献者

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