Element: fullscreenerror event
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thefullscreenerror event is fired when the browser cannot switch to fullscreen mode.
As with thefullscreenchange event, twofullscreenerror events are fired; the first is sent to theElement which failed to change modes, and the second is sent to theDocument which owns that element.
For some reasons that switching into fullscreen mode might fail, seethe guide to the Fullscreen API.
This event is not cancelable.
In this article
Syntax
Use the event name in methods likeaddEventListener(), or set an event handler property.
js
addEventListener("fullscreenerror", (event) => { })onfullscreenerror = (event) => { }Event type
A genericEvent.
Examples
js
const requestor = document.querySelector("div");function handleError(event) { console.error("an error occurred changing into fullscreen"); console.log(event);}requestor.addEventListener("fullscreenerror", handleError);// orrequestor.onfullscreenerror = handleError;requestor.requestFullscreen();Specifications
| Specification |
|---|
| Fullscreen API> # handler-document-onfullscreenerror> |