javascript - js Make Google Chrome maximize instead of full screen (F11)
给我你的怀抱
给我你的怀抱 2017-05-19 10:37:01
0
2
938

js Maximize Google Chrome instead of full screen (F11)

给我你的怀抱
给我你的怀抱

reply all(2)
黄舟

Theoretically, js supports

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

But in fact, each browser has different restrictions on this kind of behavior. Just imagine that you open a page and the page is directly made into full screen. That is very sad.
Similarly restricted, there are also windows .open, continuous pop-up alerts, etc.
This is the page permission.

There are also browser permissions. If you are developing a chrome extension, you should not be restricted

Additional point: Different similar trigger situations may have different results. Self-execution will have more restrictions, such as
document.body.onload = function() {
video.play()
};
Playing a video directly as soon as you enter the page is very frustrating. Some browsers restrict this type of behavior and can only use triggering:
document.body.onclick = function() {

video.play(); // 这就不受影响

};

淡淡烟草味
function launchFullscreen(element) {
  if(element.requestFullscreen) {
    element.requestFullscreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.msRequestFullscreen){
    element.msRequestFullscreen();
  } else if(element.webkitRequestFullscreen) {
    element.webkitRequestFullScreen();
  }
}

launchFullscreen(document.documentElement);

You can refer here to learn more: http://javascript.ruanyifeng....

However, for operations such as changing the browser size, position, and full screen, the browser believes that this should be decided by the user rather than the website developer, so this type of code is blocked by default.
A similar prompt will appear:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template