简体   繁体   中英

On page load, how can I make my browser full screen?

I have a page with a div #container which I would like to have go into full screen mode (or at least request to go into full screen mode) on supported browsers.

I downloaded this plugin and although the example all show using a button to enter fullscreen, I'd like to do it on load.

I tried:

$(window).load(function() { if($.support.fullscreen){ $('#container').fullScreen(); } });

You can do this sort of using a popup and window.open , or center it then make it H/W proportionate to the screen size. But it is a very bad idea (of course subject to popup blocking), and could be considered malicious behavior by some users. Full screen should be a choice, not a default option as there is little legitimate reason to go that route unless you offer the user at least the chance to save a setting to accept this behavior on subsequent visits. Otherwise there are tricks to get it from the main page, google can lead you that route should you decide to do it, I however still suggest highly against it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM