Javascript Browser Window resizeBy() Method resize a window

Introduction

Open a new window, and decrease the width by 50px and increase the height by 50px:

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="openWin()">Create window</button>
<button onclick="resizeWin()">Resize window</button>

<script>
var myWindow;/*w w  w.  j  av a  2 s.co m*/

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

function resizeWin() {
  myWindow.resizeBy(-50, 50);
  myWindow.focus();
}
</script>
</body>
</html>



PreviousNext

Related