Open In App
Related Articles

HTML DOM fullscreenElement Property

Improve Article
Save Article
Like Article

The fullscreenElement property in HTML is used to return the element that is currently in fullscreen. This property may require specific prefixes to work with different browsers. 



Return Value: Returns the element that is currently in full-screen mode, or null if full-screen mode is not available. 

Example: In this example, we will see the use of fullscreenElement property.


<!DOCTYPE html>
    <title>fullscreenElement method</title>
    <h1 style="color: green">GeeksForGeeks</h1>
    <p><b>fullscreenElement method</b></p>
    <p>The current fullscreen element will
        appear in the console after 5 seconds.</p>
    <img id="image"
    <button onclick="goFullScreen();">Go fullscreen</button>
        /* Log the element currently in fullscreen */
        function checkFullscreenElement() {
                /* Standard syntax */
                document.fullscreenElement ||
                /* Chrome, Safari and Opera syntax */
                document.webkitFullscreenElement ||
                /* Firefox syntax */
                document.mozFullScreenElement ||
                /* IE/Edge syntax */
        /* Call this function after 5 seconds,
        as we cannot click any button to execute
        this function while in fullscreen */
        setTimeout(checkFullscreenElement, 5000);
        /* Go fullscreen */
        function goFullScreen() {
            if (
                /* Standard syntax */
                document.fullscreenEnabled ||
                /* Chrome, Safari and Opera syntax */
                document.webkitFullscreenEnabled ||
                /* Firefox syntax */
                document.mozFullScreenEnabled ||
                /* IE/Edge syntax */
            ) {
                elem = document.querySelector('#image');
                /* Try to go Fullscreen */
            } else {
                console.log('Fullscreen is not available currently.')



Supported Browsers: The browser supported by fullscreenElement property are listed below:

  • Google Chrome 71.0 and above
  • Edge 79.0 and above
  • Internet Explorer 11.0 and above
  • Firefox 64.0 and above
  • Opera 58.0 and above
  • Safari 6.0 and above

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

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