1. Home
  2. Computing & Technology
  3. JavaScript

Browser Window Size and Position

3. Obtain the Script

Join the Discussion

Questions? Comments?

More of this Feature

Introduction Sample Add to Your Page

Related Articles

How the Script Works

To be able to determine the available space within the browser window and the current position of that window within the current web page, you need to copy the following script and attach it to the head section of your page.

Once you have created your code you just save it to an external javascript file. I called mine getscreen.js. You then link it into the head of your page using the following code:

<script type="text/javascript" src="getscreen.js">
</script>

Now all that remains is to use the functions in your Javascripts.

Introduction | Sample Page | Obtain the Script | Add to Your Scripts
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.