Using the resizeBy()
method together with resizeTo()
:
Open a new window, and resize the width and height of the new window.
<!DOCTYPE html> <html> <body> <button onclick="openWin()">Create window</button> <button onclick="resizeWinTo()">Resize the window to 800px * 600px</button> <button onclick="resizeWinBy()">Make the new window smaller</button> <script> var myWindow;//from w ww . j a v a2 s . co m function openWin() { myWindow = window.open("", "", "width=250, height=250"); } function resizeWinTo() { myWindow.resizeTo(800, 600); myWindow.focus(); } function resizeWinBy() { myWindow.resizeBy(-100, -50); myWindow.focus(); } </script> </body> </html>