Hey, that's not so bad! Is that all it takes? Well... almost. There are tricky boundary cases that come into play when resizing the window provides enough room to make a scrollbar unnecessary. Suddenly the usable page layout space, or "client area," is a little bigger than we wanted.
Can we fix that too? Yes, by resizing one more time. We perform the very same check of the amount of usable space, and we grow or shrink as needed. And that second resize finishes the job.
1. download resizing_window.js (provided in a zip file).
2. Upload resizing_window.js to your own website. Put it in the same folder with your page. You could also put it in a scripts folder and use an absolute URL in the script element below to always fetch it from the same place.
3. Create your page by following this template:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<title>YOUR TITLE GOES HERE</title>
<body onLoad="resizingWindowLoaded(YOUR WIDTH, YOUR HEIGHT)"
YOUR CONTENT GOES HERE
All of the things you need to change are capitalized for your convenience. Replace YOUR WIDTH and YOUR HEIGHT with the width and height in pixels that your layout requires.
That's all there is to it!
Note the onLoad and onResize handlers. If you need other handlers for these as well, just insert my calls first, followed by semicolons. You can call more than one function from a single event handler.
Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!