383Chapter 16Window and Frame ObjectsSupporting browsers provide two (Vps web hosting)

383Chapter 16Window and Frame ObjectsSupporting browsers provide two different points of reference for measuring the height andwidth of a window: inner and outer. Both are measured in pixels. The inner measurements arethat of the active document area of a window (sometimes known as a window s contentregion). If the optimum display of your document depends on the document display areabeing a certain number of pixels high and/or wide, the innerHeightand innerWidthproper- ties are the ones to set. In contrast, the outer measurements are of the outside boundary of the entire window, includ- ing whatever chrome is showing in the window: scroll bars, status bar, and so on. Setting theouterHeightand outerWidthis generally done in concert with a reading of screenobjectproperties (see Chapter 38 on the CD-ROM). Perhaps the most common usage of the outerproperties is to set the browser window to fill the available screen area of the visitor s monitor. A more efficient way of modifying both outer dimensions of a window is with thewindow.resizeTo()method, which is also available in IE4+. The method takes pixel widthand height (as integer values) as parameters, thus accomplishing a window resizing in onestatement. Be aware that resizing a window does not adjust the location of a window. Therefore, just because you set the outer dimensions of a window to the available spacereturned by the screenobject doesn t mean that the window will suddenly fill the availablespace on the monitor. Application of the window.moveTo()method is necessary to ensurethe top-left corner of the window is at screen coordinates 0,0. Despite the freedom that these properties afford the page author, Netscape and Mozilla-basedbrowsers have built in a minimum size limitation for scripts that are not cryptographicallysigned. You cannot set these properties such that the outer height and width of the window issmaller than 100 pixels on a side. This limitation is to prevent an unsigned script from settingup a small or nearly invisible window that monitors activity in other windows. With signedscripts, however, windows can be made smaller than 100 100 pixels with the user s permis- sion. IE4+ maintains a smaller minimum size to prevent resizing a window to zero size. Users may dislike your scripts messing with their browser window sizes and positions. NN7+/Moz1+/Safari do not allow scripts to resize windows. ExampleIn Listing 16-9, a number of buttons let you see the results of setting the innerHeight, innerWidth, outerHeight, and outerWidthproperties in NN4 and NN6. Later browsers andSafari ignore scripted adjustments to these properties. Listing 16-9:Setting Window Height and Width