Window Resize Using SetTimeout
Opening a new window onclick and resizing the window on the resize button click
by Suryar Praveen
HTML
<!DOCTYPE html>
<html>
<body>
<center>
<h1>
Resize Window
</h1>
<button onclick="openWin()">
New window
</button>
<button onclick="resizeWin()">
Resize window
</button>
<script>
var myWindow;
function openWin() {
myWindow =
window.open("", "",
"width=100, height=100");
}
function resizeWin() {
setTimeout(() => {
myWindow.resizeBy(300, 300);
myWindow.focus();
}, 500);
}
</script>
</center>
</body>
</html>