JS – BOM (Browser Object Model) – Window Resize
Create a new Window and Resize it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <!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:
1 | var myWindow; |