Fullscreen API

Enter and exit fullscreen mode

BeginnerTopic: Browser API
Back

JavaScript Fullscreen API Program

This program helps you to learn the fundamental structure and syntax of JavaScript programming.

Try This Code
function enterFullscreen(element) {
    if (element.requestFullscreen) {
        element.requestFullscreen();
    }
}

function exitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    }
}
Output
// Enters/exits fullscreen

Understanding Fullscreen API

Fullscreen API controls fullscreen mode.

Note: To write and run JavaScript programs, you need to set up the local environment on your computer. Refer to the complete article Setting up JavaScript Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your JavaScript programs.

Table of Contents