Feedback on: irt.org FAQ Knowledge Base Q240
Worth:
Worth reading
Length:
Too short
Comments:
I am using Netscape 4.5.
I'm opening a popup window with the following parameters:
toolbar=no,location=no,menubar=no,resize=yes,dependent=yes,width=400,height=230
I try to use window.resizeTo(400, 380) and it doesn't work. window.outerHeight = 380 does not work either.
resizeTo does work in IE.
Are there interactions with other parameters that cause resizeTo and outerHeight not to work on N4.5?
Worth:
Worth reading
Comments:
This works in IE5.0 and NS 4.72:
<script LANGUAGE="Javascript1.2"></script>
</head>
<body onload="resize()";>
From comp.lang.javascript.
Worth:
Very worth reading
Length:
Just right
Technical:
Just right
Comments:
I've found a hacky way to get around the IE resize discrepancy:
For IE:
<script language="javascript">
to_set_W = 300;
to_set_H = 200;
w = document.body.clientWidth;
h = document.body.clientHeight;
offW = to_set_W - w;
offH = to_set_H - h;
window.resizeBy(offW, offH);
</script>
Explanation:
IE's clientWidth and clientHeight properties are read-only; the only way to change size is through resizeTo() and resizeBy(). The hack involves reading the current clientWidth and clientHeight and then figuring out by how much it is wrong and then resize accordingly, fixing the difference.
The result is that the clientHeight and clientWidth are adjusted to be the desired dimensions, good for framing known dimensions (e.g. an image), without worrying about the window's decorations (such as menus, toobars etc.).