You are here: irt.org | FAQ | JavaScript | Window | Q1224 [ previous next ]
Try:
<body onLoad="if (document.all) { orgw = document.body.clientWidth; orgh = document.body.clientHeight; } else if (document.layers) { orgw = window.innerWidth; orgh = window.innerHeight; }" onUnload="if (document.all ||document.layers) top.resizeTo(orgw,orgh);"> <a href="javascript:;" onClick="top.resizeTo(800,600); top.moveTo(0,0); return false">800x600</a> <a href="javascript:;" onClick="top.resizeTo(1024,768); top.moveTo(0,0); return false">1024x768</a>
The following was bubmitted by Rawdyn
The solution to the question is not accurate (I hope some one can prove me wrong as it causes me heartache every day).
For IE the document.body.clientWidth is a measurement of the inner size of the window. Resizing the window to this using top.resizeTo() will resize the outer dimensions of the window (including toolbars etc) to the size specified. This means the resulting window is smaller than it should be.