Detect-and-route with JavaScript
By Molly E. Holzschlag2005-03-31
Matching pages to display resolution
If you'd like to test and route for screen resolution, the script in Listing 7 does the trick. Of course, first you need to create pages for the different screen resolutions you plan to accommodate. You don't need to identify the resolution-specific pages by name -- the script automatically handles that. Then create an empty HTML document with Listing 7 in the head portion.
In the opening body tag of the HTML document, add the following statement .
Save the page as a default or index page. Then test the script by changing your screen's resolution several times and reloading the page each time. Using this script, you can create designs optimized to the resolution dimensions of your audience.
Tutorial Pages:
» Keep users happy by using savvy scripts
» Serving user needs
» Planning ahead
» The rock-bottom lowest-common-denominator
» Route for technology, not content
» Finding scripts or rolling your own
» Detecting the details
» Routing by browser type
» Matching pages to display resolution
» Testing your scripts
» Summing up
» Resources
First published by IBM DeveloperWorks
