• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Managing Browser Windows > 6.1. Setting the Main Window’s Size

Setting the Main Window’s Size

NN 4, IE 4

Problem

You want to resize the browser window that contains the current page.

Solution

Ever since Version 4 of Internet Explorer and Netscape, scripters have been able to adjust the pixel size of the browser window with two window object methods: resizeTo( ) and resizeBy( ) . To resize the window to a specific pixel size, use the resizeTo( ) method:

window.resizeTo(800, 600);

To increase or decrease the size of the window by a fixed pixel amount, use the resizeBy( ) method:

window.resizeBy(50, -10);

Adjustments affect the outside measure of the browser window.

Discussion

Both parameters are in pixel measures and are required for both methods. The first value affects the width of the window, the second value affects the height. In the case of the resizeBy( ) method, if you want to modify only one axis value, pass a value of 0 as the other parameter.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint