The Browser Object
Finally, you should at least briefly consider the Browser Object Model
or Browser Object. Using JavaScript, you can not only read and control the page and its contents, but also read and adjust properties of the browser displaying it. This can be in the form of resizing the window, or simply getting the value of the URI displayed in the address bar. Table 26-6 summarizes a few of the common properties and methods available to you in the Browser Object, which is accessed programmatically as window
.
Table 26-6. Browser Object properties and methods
Property/method |
Description |
---|---|
|
Represents the state of an event |
|
Contains the URLs the user has visited within a browser window |
|
Gives read/write access to the URI in the address bar |
|
Sets or returns a reference to the window that created the window |
|
Returns the parent window |
|
Returns the x-coordinate of the upper-left corner of the browser relative to the upper-left corner of the screen |
|
Returns the y-coordinate of the top corner of the browser relative to the top corner of the screen |
|
Sets or returns the text in the status bar of the window |
|
Displays an alert box with a specified message and an OK button |
|
Closes the current window |
|
Displays a dialog box with a specified message and an OK and a Cancel button |
|
Sets focus on the current window |
|
Opens a new browser window |
Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.