Web >> Development >> Javascript >> Examples >>  How to get the window inner height and width

<head> <script type="text/javascript">var switchTo5x=true;</script> <script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script> <script type="text/javascript">stLight.options({publisher: "83cf11a5-04b0-47d5-b5d0-fecf32207997", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script> </head> <body> <script language="JavaScript"> <!-- var winW = 630, winH = 460; if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = window.innerWidth; winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } } //--> </script> <script language="JavaScript"> <!-- document.write("Window width = " winW "<br>" "Window height = " winH ) //--> </script> </body> </html>