Element.onfullscreenerror

Element 接口的 onfullscreenerror 属性是在Element 过渡到或退出全屏模式发生错误后处理事件fullscreenerror的事件处理程序。

语法

targetElement.onfullscreenerror = fullscreenErrorHandler;

一个处理事件fullscreenerror的事件处理程序.

示例

本示例尝试不从用户发起的事件(如点击事件click或键盘事件keypress)处理程序来触发全屏,由于全屏模式只允许由用户主动输入触发,因此该操作会发生错误,从而导致Element触发fullscreenerror事件传递给错误处理程序

let elem = document.querySelector("video")}}

elem.onfullscreenerror = function ( event ) {
  displayWarning("Unable to switch into full-screen mode.");
};

//....

elem.requestFullscreen();

规范

Specification Status Comment
Fullscreen API
onfullscreenerror
Living Standard Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
onfullscreenerrorChrome Full support 57Edge ? Firefox Full support 64
Full support 64
No support 10 — 65
Alternate Name
Alternate Name Uses the non-standard name: onmozfullscreenerror
IE ? Opera Full support YesSafari ? WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 64
Full support 64
No support 10 — 65
Alternate Name
Alternate Name Uses the non-standard name: onmozfullscreenerror
Opera Android Full support YesSafari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Uses a non-standard name.
Uses a non-standard name.

其他