Make google-chrome browser go fullscreen when page loads

Viewed 6650

Please consider answering this question here even if you mark it as a duplicate because for some reason I just can't get it to work with other solutions and though I tried to ask for help no one replied...

What I really want is to $(document).ready(function(){browser goes fullscreen}) but unfortunately it isn't working and I am desperate through trying to find a solution online because nothing appears to work! I have the js file well inserted in my main php file (console.log works) but it just won't load fullscreen no matter the lines of code...

If you can provide a solution to work in all browsers and with keys activated I would be really, really thankful. Otherwise I'll contempt myself with the google chrome answer. Thank you so much.

EDIT1:

I tried this

// mozilla proposal
element.requestFullScreen();
document.cancelFullScreen(); 

// Webkit (works in Safari and Chrome Canary)
element.webkitRequestFullScreen(); 
document.webkitCancelFullScreen(); 

// Firefox (works in nightly)
element.mozRequestFullScreen();
document.mozCancelFullScreen(); 

// W3C Proposal
element.requestFullscreen();
document.exitFullscreen();

The following one only under user interaction:

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

amongst others I can't find now and basically I have combined them with $(document).ready(function(){---}); but nothing happened.

1 Answers
Related