It's not very standardised.
This was one of the most difficult things to get cross-browser. In fact, I could not do it without browser-detection. The following is from the latest version of X.
Good luck 
Code:
function xClientWidth() {
var w=0;
if(xOp5or6) w=window.innerWidth;
else if(xIE4Up && document.documentElement && document.documentElement.clientWidth)
w=document.documentElement.clientWidth;
else if(document.body && document.body.clientWidth)
w=document.body.clientWidth;
else if(xDef(window.innerWidth,window.innerHeight,document.height)) {
w=window.innerWidth;
if(document.height>window.innerHeight) w-=16;
}
return w;
}
function xClientHeight() {
var h=0;
if(xOp5or6) h=window.innerHeight;
else if(xIE4Up && document.documentElement && document.documentElement.clientHeight)
h=document.documentElement.clientHeight;
else if(document.body && document.body.clientHeight)
h=document.body.clientHeight;
else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
h=window.innerHeight;
if(document.width>window.innerWidth) h-=16;
}
return h;
}
// supporting function and variables
function xDef() {
for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=="undefined") return false;}
return true;
}
var xOp5or6=false,xIE4Up=false,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
xOp5or6=(xUA.indexOf('opera 5')!=-1 ||
xUA.indexOf('opera/5')!=-1 ||
xUA.indexOf('opera 6')!=-1 ||
xUA.indexOf('opera/6')!=-1);
}
else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;}
Bookmarks