Finding innerWidth and innerHeight of window in IE

The title basically sums it up in a nutshell, I need to find a way to get the width and height of the window minus the toolbars and scrollbars. In firefox I can achieve this with:


IE does not support this, and I've yet to find some other way to do this.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In IE you can use document.body.clientHeight or document.documentElement.clientHeight for standard mode (non quirks). But these will only work after the body was loaded, i.e. you can access them inside a OnLoad handler.
drakkarnoirAuthor Commented:
It says object expected when I try to alert(document.body.clientHeight), another useful IE error message.
Michel PlungjanIT ExpertCommented:
Show some code, please
Samuel LiewCommented:
You need three sets of code, one for Netscape, one for Explorer 6 if you use a DOCTYPE, and one for Explorer in all other cases:

if (self.innerWidth) {
      frameWidth = self.innerWidth;
      frameHeight = self.innerHeight;
else if (document.documentElement && document.documentElement.clientWidth) {
      frameWidth = document.documentElement.clientWidth;
      frameHeight = document.documentElement.clientHeight;
else if (document.body) {
      frameWidth = document.body.clientWidth;
      frameHeight = document.body.clientHeight;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.