Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
HTML DOM exitFullscreen() method
The HTML DOM exitFullscreen() method is used for getting an element currently in the full screen mode to get out of that mode. It does nothing if executed on an element that isn?t in the full screen mode already.
Syntax
Following is the syntax for exitFullscreen() method ?
HTMLElementObject.exitFullscreen()
Example
Let us look at an example for the exitFullscreen() method ?
exitFullscreen() method example
![]()
The Eiffel Tower was built on 28 January 1887
Output
This will produce the following output ?

On clicking the Fullscreen View ?

You will get back to original screen size either by hitting Esc key on keyboard or clicking the "Normal view" button ?
In the above example ?
We have created two buttons "FullScreen View" and "Normal View" that will execute the GoFullScreen() or GoNormal() functions respectively when clicked by the user ?
The GoFullscreen() function gets the document root element which in HTML documents is an element. It then checks to see if the screen isn?t already in the fullscreen mode by getting the document?s boolean requestFullScreen property value. If it isn?t in fullscreen view, then it executes the requestFullScreen() method using the element. You can take any other element too and it will enable full screen for that element only ?
function GoFullscreen() {
if (docEle.requestFullscreen)
docEle.requestFullscreen();
}
The GoNormal() function gets the document?s exitFullScreen boolen property value to check if the screen isn?t already in the normal view. If the screen isn?t in normal view then it executes the document?s exitFullScreen() method ?
function GoNormal() {
if (document.exitFullscreen)
document.exitFullscreen();
} 