- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to make a fullscreen window with JavaScript?
To create a fullscreen window with JavaScript, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <style> body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } button{ display: block; padding:10px; margin:10px; background-color: rgb(81, 0, 128); border:none; color:white; } </style> <body> <h1>Fullscreen Window with JavaScript Example</h1> <button class="openVideo";">Open Video in Fullscreen Mode</button> <video width="500px" controls id="minimizedVideo"> <source src="https://www.videvo.net/videvo_files/converted/2015_04/preview/Ocean_Waves_slow_motion_videvo.mov44965.webm"> </video> <h2>Click on the above button to open it in fullscreen</h2> <script> document.querySelector('.openVideo').addEventListener('click',fullscreenVideo); var elem = document.getElementById("minimizedVideo"); function fullscreenVideo() { if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); } } </script> </body> </html>
Output
The above code will produce the following output −
On clicking the “Open Video in Fullscreen Mode” button −
- Related Articles
- How to Create Fullscreen API using JavaScript?
- Forcing Tkinter window to stay on top of fullscreen in Windows 10?
- How to make a Tkinter window not resizable?
- How to make a Tkinter window jump to the front?
- How to create a popup chat window with CSS and JavaScript?
- How to make Tkinter Window appear in the taskbar?
- How to Make a DIV 100% of the Window Height using CSS
- How to open link in a new window - JavaScript?
- How to display a tkinter application in fullscreen on macOS?
- How to center a popup window on screen using JavaScript?
- How to create a borderless fullscreen application using Python-3 Tkinter?
- How to create a browser window example with CSS?
- How to Set a Tkinter Window with a Constant Size?
- How to set fullscreen mode for Java Swing Application?
- How to make flexible items display in columns with JavaScript?

Advertisements