The window supports the full-screen interface by using web API. We can activate or deactivate the full-screen mode of the screen. The fullscreen API provides methods to present a specific element in a full-screen mode.
- The onclick event will trigger the activate() method which will be for activating the full screen.
- The same will be applied for exiting from the full screen.
<button onclick="activate(document.documentElement);"> Go To Full Screen </button> <button onclick="deactivate();"> Leave Full Screen </button>
You can apply it to any element in your website
It will help to execute the full screen.