Window Properties
When you open your browser, an instance of a window
object is
created, and that object's properties become available for your inspection or use. These properties
are accessible using the formats shown in Figure 7-3.
property
window.property
Figure 7-3. Formats to reference window properties.
Window properties can be referenced with the prefix window
or by using just
the property
name wherein the window
prefix is assumed.
Common Window Properties
Below are shown common window object properties for setting or viewing.
Properties are reported for the current window you are viewing using inline scripts in the format
document.getElementById("Output").innerHTML = window.property;
Property |
Description and Setting |
innerHeigth |
The inner height of the browser window (not including toolbars/scrollbars)
window.innerHeight =
|
innerWidth |
The inner width of the browser window (not including toolbars/scrollbars)
window.innerWidth =
|
location |
Gets or sets the URL of the document in the window.
window.location =
|
Figure 7-4. Common window
properties.