Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

full-screen browser window on load document

How can I full-screen browser window after loading the page? I have used code like below in jQuery but its working only using the event click; but I want that to be worked on load.

jQuery(document).ready(function($) {
    function fullScreen(){
            var docElm = document.documentElement;
            if (docElm.requestFullscreen) {
                //alert("requestFullscreen");
                docElm.requestFullscreen();
            }
            else if (docElm.mozRequestFullScreen) {
                //alert("mozRequestFullScreen");
                docElm.mozRequestFullScreen();
            }
            else if (docElm.webkitRequestFullScreen) {
                //alert("webkitRequestFullScreen");
                docElm.webkitRequestFullScreen();
            }

    }
});
like image 612
itsazzad Avatar asked Apr 27 '12 14:04

itsazzad


People also ask

How do I make my browser window open full screen?

Make the browser window fullscreen On a Windows computer, you can set Google Chrome, Internet Explorer, Microsoft Edge, or Mozilla Firefox to full-screen mode, hiding the toolbars and address bar by pressing the F11 key.

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

Solution 1 Tell him/her to press F11 on the keyboard and the browser window will become full screen.

How do I view a Web page full screen?

The "F11" key toggles back and forth between full-screen and standard modes in all major Web browsers, including Internet Explorer.

Which function is used for making the website fullscreen?

var elem = document. getElementById("myvideo"); /* When the openFullscreen() function is executed, open the video in fullscreen.


1 Answers

from https://wiki.mozilla.org/Gecko:FullScreenAPI#Suggested_UA_Policy

..requestFullScreen while the window is already in the full-screen state is approved. Otherwise, requestFullScreen outside a user action (e.g. a non-synthesized input event handler) is denied.

so it's not possible force a fullscreen if it's not triggered by a user action

like image 57
Fabrizio Calderan Avatar answered Oct 25 '22 02:10

Fabrizio Calderan