Programming C# C++ (7) Delphi (604) Java (8) JavaScript (55) Document (8) Events (8) Strings (3) perl (40) php (12) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us
|
How do I read or set the browser's window size?
1 comments. Current rating: (1 votes). Leave comments and/ or rate it.
As often, Netscape and Internet Explorer use different properties to store the window size. After determining the browser type, the code uses either Netscape's innerHeight and innerWidth properties or IE's resizeto() function.
Other usefule functions available in IE are
self.resizeBy(x, y)
self.moveTo(x, y)
self.moveBy(x, y)
Note that in order to read the size related properties in Internet Explorer, this javascript has to be placed behind the tag.
 | |  | | <script>
if (window.outerHeight) {
oH = window.outerHeight;
oW = window.outerWidth;
alert("Height: " + oH + "px Width: " + oW + "px");
window.outerHeight = 500;
window.outerWidth = 400;
}
else {
iW = document.body.clientWidth;
iH = document.body.clientHeight;
alert("Inner Width: " + iW + "px Inner Height:" + iH);
self.resizeTo(500,400);
}
</script>
| |  | |  |
Comments:
|