简体   繁体   中英

force maximum browser size on page load

I'm wondering if it is at all possible to use JavaScript to detect if the user's browser is minimized (not completely minimized -- just reduced size to smaller then maximize) at all, and if it is then > force full screen > upon page load of website.

$( document ).ready(function() {
   if (smaller then max screen) {
   screen = 100%; // general idea
});

Yes it is possible to detect change of size, here's how to do it,using jQuery:

$(window).resize(function() {
  //...
});

And here's how to maximize the browser window :

window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);

But really, I would not encourage it, as it's better that the user controls the browsing experience.

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