Skip to content
Related Articles

Related Articles

HTML | DOM exitFullscreen() Method

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 25 Jul, 2019

The exitFullscreen() method requests the element which is currently in a full-screen mode to be taken out of full-screen mode. If element is not in full-screen mode, then nothing gets changed. The reverse of this method is requestFullscreen().



Parameters: No parameters required.

Return Value: No return value.


<!DOCTYPE html>
      HTML | DOM exitFullscreen() Method
    <!--script for close and open fullscreen-->
        var elem = document.documentElement;
        function closeFullscreen() {
            if (document.exitFullscreen)
        function openFullscreen() {
            if (elem.requestFullscreen)
    <h2>Welcome to GeeksforGeeks</h2>
      Click on the "Open Fullscreen" button to open this page in" 
      + "fullscreen mode. Close it by either clicking the "Esc" key"
      +" on your keyboard, or with the "Close Fullscreen" button.
    <button onclick="openFullscreen();">
      Open Fullscreen
    <button onclick="closeFullscreen();">
      Close Fullscreen

Open Fullscreen

Exit Fullscreen

Supported Browsers: The browser supported by DOM exitFullscreen() Method are listed below:

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!