How do I read or set the current window's size?
Netscape and IE use different properties for reading the size of a window. You set the size of a current window in Netscape by setting the innerHeight and innerWidth or outerHeight and outerWidth properties. Inner refers to the window's content area (where your HTML sits) and Outer refers to the windows borders (the size of the whole browser window).
To read the values in Netscape :
<script>
oH = window.outerHeight;
oW = window.outerWidth;
alert("Height: " + oH + "px Width: " + oW + "px");
</script>
To set the current window's dimensions in Netscape
<script>
window.outerHeight = 500;
window.outerWidth = 400;
</script>
You can place the script anywhere in you HTML document. The closer to the top, the quicker the script will be read and executed. Use the innerWidth and innerHeight to control the size of the content area.
The method used to resize the Window in Internet Explorer is as such:
<script>
self.resizeTo(500,400);
</script>
where 500 is the width and 400 is the height. To read the size of the window's content area in Internet Explorer you must place this script after the <body> tag :
<script>
iW = document.body.clientWidth;
iH = document.body.clientHeight;
alert("Inner Width: " + iW + "px Inner Height:" + iH);
</script>
Internet Explorer also has executes the following methods
self.resizeBy(x,y);
self.moveTo(x, y);
self.moveBy(x,y);
where x and y are the absolute pixel positions. That is, you use numbers in place of x and y.