Client Window Size
General
Use this snippet to obtain the width and height of the visitor's client window. This is a much better method than getting the resolution as this is the actual size of the window displaying the Web page.
Notes
- Created by: Konstantin Jagello
- Web Site: http://javascript-array.com/
- Posted: July 7, 2008
Example
var width = document.compatMode=='CSS1Compat' &&
!window.opera?document.documentElement.clientWidth:
document.body.clientWidth;
var height = document.compatMode=='CSS1Compat' &&
!window.opera?document.documentElement.clientHeight:
document.body.clientHeight;
document.write("Your client window width is: "+width+"<br>
Your client window height is: "+height+"");
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: clientWindowSize.js
Head
Paste this code into the HEAD section of your HTML document.


Leave a Response
(2 comments)Your question is beyond the scope of these comments. You will need to post it over on [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]the JavaScript forum[/a]. Thanks!
This is a potentially useful script---how would I apply it to resize the appearance of a Web page to match the client's window?