Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM requestFullscreen() Method

  • Last Updated : 30 Nov, 2019

The requestFullscreen() method opens the element in a full-screen mode. If the element is in full-screen mode, then nothing gets changed. The reverse of this method is exitFullscreen() method.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

HTMLElementObject.exitFullscreen()

Parameters: It does not accept any parameters.

Return Value: It does not return any value.



Example:




<!DOCTYPE html> 
<html
  
<head
    <title
        HTML DOM requestFullscreen() Method
    </title
      
    <script
        var elem = document.documentElement; 
  
        function closeFullS() { 
            if (document.exitFullscreen) 
                document.exitFullscreen(); 
        
  
        function openFullS() { 
            if (elem.requestFullscreen) 
                elem.requestFullscreen(); 
        
    </script
</head
  
<body style="text-align:center;"
  
    <h1 style="color:green">
        GeeksforGeeks
    </h1
      
    <h2>
        HTML DOM requestFullscreen() Method
    </h2>
      
    <button onclick="openFullS();"
        Open Fullscreen 
    </button
      
    <button onclick="closeFullS();"
        Close Fullscreen 
    </button
</body
  
</html>         

Output:

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

  • Chrome
  • Firefox
  • Internet Explorer
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!