exitFullscreen() in javascript

exitFullScreen() method in javascript

exitFullScreen() method is used to exit to the normal mode from the full screen mode.

This method is browser dependent, so for each browser different method name should be used, they are

  • Standard version - exitFullscreen
  • chrome - webkitExitFullscreen
  • Firefox - mozCancelFullScreen
  • Internet Explorer - msExitFullscreen


Try Yourself

Example Explanation

  • When the button1 is clicked, fun_name1 function is called, and whole document is displayed in full screen mode.
  • When the button2 is clicked, fun_name2 function is called.
  • Using if statement we are checking which command is supported in the current browser, and that method will be executed and the whole window will exit from full screen mode.