Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Window resizeTo() method

Window resizeTo() method

Window Object Reference Window Object


Example

Create a window, setting the width and height to 500px:

var

w

;

function

openwindow

(

)

{

w

=

window

.

open

(

'

'

,

'

'

,

'

width=100,height=100

'

)

;

w

.

focus

(

)

;

}

function

myFunction

(

)

{

w

.

resizeTo

(

500

,

500

)

;

w

.

focus

(

)

;

}

Try it »

Definition and Usage

The method is used to resize the window to the specified width and height.

Syntax

window

.resizeTo(

width,height

)

Parameters Description
width Required. Sets the width of the window, in pixels
height Required. Sets the height of the window, in pixels

Browser support

All the latest versions of browsers support the resizeTo() method.

Chrome Edge Firefox Safari Opera IE
Supported Supported Supported Supported Supported Supported

Example

Example

Using resizeBy() and resizeTo():

function

resizeWinTo

(

)

{

myWindow

.

resizeTo

(

800

,

600

)

;

myWindow

.

focus

(

)

;

}

function

resizeWinBy

(

)

{

myWindow

.

resizeBy

(

100

, -

50

)

;

}

Try it »


Window Object Reference Window Object