Open In App
Related Articles

HTML DOM exitFullscreen() Method

Improve Article
Save Article
Like Article

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



Parameters: No parameters are required. 

Return Value: No return value. 

Example: In this example, we will use exitFullscreen() method


<!DOCTYPE html>
        HTML | DOM exitFullscreen() Method
    <!--script for close and open fullscreen-->
        let 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



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

  • Google Chrome 71 and above
  • Edge 79 and above
  • Internet Explorer 11 and above
  • Firefox 64 and above
  • Opera 58 and above
  • Safari 5.1 and above

Last Updated : 09 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials