Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




The JavaScript FAQ
Prev Home Next

Resizing a window

Question: How do I resize a window?

Answer: In Netscape Navigator 4 or Internet Explorer 4, you can resize the browser window by using the methods window.resizeTo(newWidth,newHeight) or window.resizeBy(DX,DY).

Note, however, that older browsers do not support these methods. The best course of action here is probably "do nothing in an old browser". For example, this code will resize the window to 600x400 in newer browsers, without causing errors in old browsers:

if (parseInt(navigator.appVersion)>3)
Note also that the parameters of resizeTo() have different meaning in different browsers: in Internet Explorer the parameters specify the outer size of the window, while in Netscape Navigator they refer to the inner size (which does not include the window borders, toolbar, status bar, title bar, and the address line). To resize the window to the same outer size in both browsers, you can use this function:
function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
   else top.resizeTo(w,h);
} Copyright © 1999-2006, Alexei Kourbatov

The JavaScript FAQ
Prev Home Next

  Mirrored with kind permission of Alexei Kourbatov Design by Interspire