1. Get the effective width of the browser window (excluding toolbars and scroll bars)
Note: For most browsers use window.innerwidth to get width, use document.documentElement.clientWidth | | Document.body.clientWidth in order to achieve support for ie6,7.
Height ibid.
var w=window.innerwidth | | document.documentElement.clientWidth | | document.body.clientWidth; var h=window.innerheight | | document.documentElement.clientHeight | | document.body.clientHeight; X=document.getelementbyid ("Screen_size"); X.innerhtml= "Browser's internal window width:" + w + ", Height:" + H + ". "
2. Get the effective width of the screen
document.write ("Screen available size, Width:" + screen.availwidth+ ", High:" +screen.availheight);
3.location related (get Web server related information)
document.write ("Domain name of the web host:" +location.hostname+ "<br/>"); document.write ("Path and file name of the current page:" +location.pathname+ "<br/>"); document.write ("Port for web host:" +location.port+ "<br/>"); document.write ("Web protocol used:" +location.protocol+ "<br/>"); document.write ("URL of the current page:" +location.href+ "<br/>");
Javascript: Get the available width of the browser window and screen