The Disturbed Buddha

Simple Observations of a Self-proclaimed Novice

Determining a Browser’s Dimensions with Javascript

This is about as cross-browswer compatible as you can get:

<script type="text/javascript"> 
    var winW, winH; 
    if (self.innerWidth) { 
        winW = self.innerWidth; 
        winH = self.innerHeight; 
    } else if (document.documentElement && document.documentElement.clientWidth) { 
        winW = document.documentElement.clientWidth; 
        winH = document.documentElement.clientHeight; 
    } else if (document.body) { 
        winW = document.body.clientWidth; 
        winH = document.body.clientHeight; 

January 22, 2008 - Posted by | ASP.NET, Javascript, Web Development

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: