Skip to content
Related Articles

Related Articles

HTML | DOM fullscreenerror Event
  • Last Updated : 24 Jul, 2019

The HTML DOM fullscreenerror event occurs when an element can not be viewed in fullscreen mode, even if it has been requested.
Use the element.requestFullscreen() method to view an element in fullscreen mode and the element.exitFullscreen() method to cancel fullscreen mode.

Syntax:

  • In HTML:
    <element onfullscreenerror="myScript">
  • In JavaScript:
    object.onfullscreenerror = function(){myScript};
  • In JavaScript, using the addEventListener() method:
    object.addEventListener("fullscreenerror", myScript);

Using prefixes for cross-browser code:

  • Standard syntax:




    document.addEventListener("fullscreenerror", function() {
      ...
    });
  • Firefox:




    document.addEventListener("mozfullscreenerror", function() {
      ...
    });
  • Chrome, Safari and Opera:




    document.addEventListener("webkitfullscreenerror", function() {
      ...
    });
  • Edge:




    document.addEventListener("msfullscreenerror", function() {
      ...
    }); 

Example: Display an alert message if an element can not be viewed in fullscreen mode:




document.addEventListener("fullscreenerror", function() {
  alert("Error in Fullscreen")
}); 

Supported Browsers: The browsers supported by HTML DOM fullscreenerror Event are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :