Entry
How do I get the size in Pixels of the current browser window in IE?
May 9th, 2001 04:20
Colin Fraser, Chris Lamb,
The problem for IE is that there is not equivalent for NN's
window.innerWidth and window.innerHeight which is what, I assume, you
have been using. This is not working for you in IE so you have to do
something different.
IE uses document.body.clientWidth and document.body.clientHeight to
return the same as window.innerWidth and window.innerHeight. In this
case, you can do with something like :
if (document.body && document.body.clientWidth) {
window.innerWidth = document.body.clientWidth;
window.innerHeight = document.body.clientHeight;
}
This means you kan use the same property for both browsers without
error. You can test this in IE by using
alert(window.innerWidth);
alert(window.innerHeight);
Untested so watch out for typos, and if it fails to work, "I know
nothing..nothing" ...