[ILUG-Webdev] Resizing windows

Niall O Broin niall at linux.ie
Tue Mar 11 00:49:11 GMT 2003


I have code which displays a largish image in a preview window, together with 
some information about the image. I use this javascript to neatly resize the 
window for the size of the content:


window.innerHeight = document.height + 20;
window.innerWidth = document.width + 20;

which very nicely resizes the window based on how much space its content needs 
leaves just a little blank all round. However this code only works in 
Navigator 4.7 so as you can imagine, not many people get the benefit of it 
any more.

For other browsers, I pass window sizes from the server. However, these are 
only approximations, and can result in my having windows with scrollbars, 
which is exactly what I want to avoid. Is there some nifty DOM based way of 
doing something like this for current browsers ?




Niall




More information about the Webdev mailing list