Browser Objects
The term Browser Object Model (BOM), or simply the Browser Objects,
refers to objects that represent the various aspects of the Web Browser
and Web page (document) loaded into the browser.
The browser creates the following browser objects automatically when a page is loaded.
window (object representing the browser window)
screen (object representing the computer screen)
location (object representing the URL of the page loaded into the browser)
history (object representing the URLs in the recent "surfing history" of the browser)
navigator (object representing the browser browser software itself)
document (object representing the Web Page)
A good starting point to see the nature of the above objects is to look at the list of properties and methods
of each object in the W3Schools reference pages.
-
W3Schools Window Object Reference
The properties contain the physical state of the browser window (size, etc) and the methods allow for various window-related actions,
such as creating new windows and resizing them.
One of the most common uses is to create new windows, sometimes called popups, using the window.open() method.
Example Use:
Create Popup Window -
Close Popup Window
-
W3Schools Screen Object Reference
The properties contain the physical state of the computer monitor (resolution, color depth, etc).
The properties are read only meaning you can't change them (makes sense if you think about it).
This object has no methods.
Some sites collect info about the screens (displays) that request their pages.
W3Schools Screen Stats
are collected by reading properties of the screen object.
Some Property Values of the Screen Object reported by this browser:
-
W3Schools Location Object Reference
The properties contain information about the URL of the page loaded into the window. The methods allow for loading new pages
or re-loading the current one.
Example Use:
Reload this Page by calling location.reload()
Some Property Values of the Location Object generated by this page load
(very different values if you load this page off your desktop vs the online version):
-
W3Schools History Object Reference
Its one property gives the length of the surfing history of the open window.
The methods allow for moving backward and forward in the surfing history.
For example, hitting the browser's built-in back button is equivalent to calling the history.back() method.
Calling history.go(-2) is equivalent to hitting the the browser's built-in back button twice.
-
W3Schools Navigator Object Reference
The properties contain information about the software browser software itself like its name and version.
The methods aren't very useful. But search engines use the stats below to compile demographics on what
types of computers and browsers people are surfing with.
Some Property Values of the navigator Object generated by this page load:
-
W3Schools Document Object Reference
This object is quite complicated, so discussion of it is best left to the lesson on DHTML (Dynamic HTML).
DHTML basically refers to manipulating the document object to creates interactive effects in Web pages.
Example Use:
Click to change two properties of the document object