header
 
     
 
pixel
pixel pixel

Determine the width of the browser window

This javascript gives you the width of your browser window, useful if your design depends on the size of the screen. Note that Netscape & Internet Explorer both use different variable names.
<script language=javascript>
if(navigator.appName == "Netscape")
    { 
    windowwidth = window.innerWidth;
    }
else if(navigator.appName == "Microsoft Internet Explorer")
    { 
    windowwidth = document.body.clientWidth;
    }
</script>

Unhelpful Helpful Rating 3.4 (score out of 5, no. of ratings: 15)
Comments
Comment by matt on 2005-12-05
is there a way to detect height of the browser window thanks?

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image