Document.onfullscreenerror

Document.onfullscreenerror 属性是一个事件处理器用于处理 fullscreenchange (en-US) 事件,在当前文档不能进入全屏模式,即使它被请求时触发。

语法

targetDocument.onfullscreenerror = fullscreenErrorHandler;

示例

document.onfullscreenerror = function ( event ) {
  console.log("FULL SCREEN DENIED")
};

// requestFullscreen()将会失败,因为它在事件处理器之外
document.documentElement.requestFullscreen();

规范

Specification Status Comment
Fullscreen API
onfullscreenerror
Living Standard Initial definition.

浏览器兼容性

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! (en-US)

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 45 47 (47)[1] (behind full-screen-api.unprefix.enabled ? ? ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support 45 45 47 (47) [1] (behind full-screen-api.unprefix.enabled ? ? ? ?

[1] 在Firefox 49之前, 此属性从技术上来说属于GlobalEventHandlers, 但把相关的事件处理器绑定在一个 Element上时却永远不会触发.

相关文章