Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1224 Is it possible to resize the browser to a preferred size, and then set it back to the original size one the visitor leaves?

irt.org | Knowledge Base | JavaScript | Window | Q1224 [ previous next ]

Q1224 Is it possible to resize the browser to a preferred size, and then set it back to the original size one the visitor leaves?

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.

Feedback on 'Q1224 Is it possible to resize the browser to a preferred size, and then set it back to the original size one the visitor leaves?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.