Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM fullscreenerror Event

  • Last Updated : 30 Jul, 2021

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.
Supported Tags 

  • It supports all HTML elements. 

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: 
     

javascript




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

javascript






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

javascript




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

javascript




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

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

javascript




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 :

Start Your Coding Journey Now!