How to resize a window to a size in Javascript

Description

The browser window can be resized using the resizeTo() and resizeBy() methods. resizeTo() expects a new width and height and resizeBy() expects the differences in each dimension.

Example


<!DOCTYPE HTML> 
<html> 
    <body> 
        <script type="text/javascript"> 
            <!--  w  w  w. j a v  a2s  .  c  o m-->
                //resize to 100 x 100 
                window.resizeTo(100, 100); 
                //resize to 300 x 300 
                window.resizeTo(300, 300); 
                //resize to 200 x 150 
                window.resizeBy(100, 50); 
                
        </script> 
    </body> 
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window