Determining the Browser Window's DimensionsThe browser window's current width and height can be determined. (Note: Internet Explorer does not support this JavaScript code.) This information is the total width and height of the browser window, including all the controls around the display area, and can be accessed using the outerHeight and outerWidth objects (Figure 13.21). Figure 13.21. The general syntax for the outerWidth and outerHeight objects.
In this example (Figure 13.22), the browser windows dimensions are displayed when the page loads. Resizing the window and reloading the page will show the new dimensions (Figure 13.23). Figure 13.22. The code displays the dimensions of the browser window.Figure 13.23. When the page is resized, the values will change.To find the browser window's dimensions:
Tip
|