Window resizeTo() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window resizeTo


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

Parameter Values

Parameter Type Description
width Number Required. Sets the width of the window, in pixels
heightNumber Required. Sets the height of the window, in pixels

Return Value:

No return value

The following code shows how to Open a new window, and set its width and height to 250px:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="openWin()">Create window</button>
<button onclick="resizeWin()">Resize window</button>

var myWindow;//from  w w  w .j  a  va 2 s  .c  o  m

function openWin() {
    myWindow ="", "", "width=100, height=100");

function resizeWin() {
    myWindow.resizeTo(250, 250);


Related Tutorials