Home / ASP.NET Wiki / Javascript / Calculate Client Height in javascript

Calculate Client Height in javascript

 Rate It (0)

Hi,

  Following code will help the developer to calculate exact client height in all browsers.

 

<script language="javascript" type="text/javascript">
var winW = 630, winH = 460;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
else
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.documentElement.clientWidth;
  winH = document.documentElement.clientHeight;
 }
else
{
winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
}
}

document.write(
 "Window width = "+winW+"<br>"
+"Window height = "+winH
)
</script>

Revision number 1, Monday, May 31, 2010 9:27:39 PM by amoljk2009
This is not the most up to date version of this article. The most recent version can be found here.

Comments

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)