To get the size of the browser window (the viewport of the browser, excluding toolbars and scroll bars):
First, for ie9+, Chrome, Firefox, Opera and Safari:
window.innerheight-Interior height of the browser window
window.innerwidth-Interior width of the browser window
Second, for Internet Explorer 8, 7, 6, 5:
Document.documentelement.clientheight represents the current height of the window in which the HTML document resides.
Document.documentelement.clientwidth represents the current width of the window in which the HTML document resides.
Or
The Body property of the Document object corresponds to the <body> tag of the HTML documents
document.body.clientheight
document.body.clientwidth
JavaScript scenarios that are useful in different browsers:
var w= document.documentElement.clientWidth | | Document.body.clientwidth;var h= Document.documentElement.clientHeight | | document.body.clientHeight;
JS get browser window viewable area size