First, Window object:
(1), all browsers support the Window object, which represents the browser window. All JavaScript global objects, functions, and variables automatically become members of the Window object.
(2), the global variable is the property of the Window object, and the global function is the method of the Window object.
Second, Window object methods and properties: (https://www.w3cschool.cn/jsref/obj-window.html)
Third, Window size judgment:
(1) for IE9 to IE9, Chrome, Firefox, Opera and Safari:
Window.innerheight-Internal height of the browser window (including scroll bars)
Window.innerwidth-Internal width of the browser window (including scroll bars)
(2), for IE 8, 7, 6, 5:
Document.documentElement.clientHeight
Document.documentElement.clientWidth
Or
Document.body.clientHeight
Document.body.clientWidth
JavaScript determines the size of all browser windows:
<div id= "Demo" style= ' border:1px solid red ' ></div>
<script>
var W=window.innerwidth | | Document.documentElement.clientWidth | | Document.body.clientWidth;
var H=window.innerheight | | Document.documentElement.clientHeight | | Document.body.clientHeight;
X=document.getelementbyid ("demo");
X.innerhtml= "browser window width:" + w + "px" + ", Height:" + H + "px. "
</script>
JavaScript Window Browser Object model