JS – BOM (Browser Object Model) – Window Resize

Create a new Window and Resize it!

<!DOCTYPE html>
<html>
<body>

<p>Open a new window, and resize the width and height to 500px:</p>

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

<script>
var myWindow;

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

function resizeWin()
{
myWindow.resizeTo(250,250);
myWindow.focus();
}
</script>

</body>
</html>

Notice you need define the:

var myWindow;

My official WebSite >