Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a web page automatically in full screen mode

How do I open a web page automatically in full screen mode?

I am looking for a solution to open an web page automatically in full screen mode, without expecting user to users press F11 or any other browser-specifc key.

I've searched a lot, but I just could not find a solution.

Is there a script or library or browser specific API available to help me achieve this?

like image 401
shakthydoss Avatar asked Oct 14 '13 07:10

shakthydoss


People also ask

How do I get browser to open full screen automatically?

Enable and Disable Full-Screen Mode in Chrome for Windows The quickest way to get Chrome in full-screen mode in Windows is to press F11 on the keyboard. The other way is through the Chrome menu: In the upper-right corner of Chrome, select the menu (three-dot) icon.

How do I make HTML Auto full screen?

Full-screen can be activated for the whole browser window by pressing the F11 key. It can be exited by pressing the Esc button. It is also possible to make a specific element in the page to enter and exit full-screen mode programmatically using Javascript Fullscreen API.


1 Answers

For Chrome via Chrome Fullscreen API

Note that for (Chrome) security reasons it cannot be called or executed automatically, there must be an interaction from the user first. (Such as button click, keydown/keypress etc.)

addEventListener("click", function() {     var           el = document.documentElement         , rfs =                el.requestFullScreen             || el.webkitRequestFullScreen             || el.mozRequestFullScreen     ;     rfs.call(el); }); 

Javascript Fullscreen API as demo'd by David Walsh that seems to be a cross browser solution

// Find the right method, call on correct element function launchFullScreen(element) {   if(element.requestFullScreen) {     element.requestFullScreen();   } else if(element.mozRequestFullScreen) {     element.mozRequestFullScreen();   } else if(element.webkitRequestFullScreen) {     element.webkitRequestFullScreen();   } }  // Launch fullscreen for browsers that support it! launchFullScreen(document.documentElement); // the whole page launchFullScreen(document.getElementById("videoElement")); // any individual element 
like image 180
BrownEyes Avatar answered Sep 27 '22 18:09

BrownEyes