CancelImage Upload

How to resize a browser window using JavaScript

Usually the code discussed on this page would be applied to a page that was opened via a target blank anchor tag. Indeed, resizing a normal browser window (instead of a "pop-up" window), may cause your website visitors a certain level of concern.

Resizing the current window however is a simple enough task. All that is required is the function resizeTo() added to the window object:

<title>How to resize a browser window using JavaScript</title>
<body onload="window.resizeTo(400, 400);">

Your content here


As you can see this function is nothing to complex. Here a closer look at the function resizeTo():

window.resizeTo(Width in Pixels, Height in Pixels);

Want to leave a comment?

No problem. Just enter your email and password below.

register | home | reminder

myDesignTool Networking •