Window resizeTo()

Example 1

Open a new window, and resize it to 300 x 300:

function openWin() {
  myWindow = window.open("", "", "width=200, height=100");
}

function resizeWin() {
  myWindow.resizeTo(300, 300);
}
Try it Yourself »

More examples below.


Description

The resizeTo() method resizes a window to a new width and height.


Syntax

window.resizeTo(width, height)

Parameters

Parameter Description
width Required.
The new window width, in pixels
height Required.
The new window height, in pixels

Return Value

NONE


More Examples

Using resizeTo() with resizeBy():

function resizeWinTo() {
  myWindow.resizeTo(800, 600);
}

function resizeWinBy() {
  myWindow.resizeBy(-100, -50);
}
Try it Yourself »

Browser Support

resizeTo() is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.