Browser Object Model
Browser Object Model and the Lack of Standards
There is no standard for the Browser Object Model. While some aspects of the BOM are implemented consistently across browsers, many of the most useful ones are not. Here, we explain the implications.
Introduction to the Browser Object Model
Understanding the Window Object
Timeouts and Intervals
Not all of the properties and methods attached to the document belong to the Document Object Model. Some of them are part of the Browser Object Model, and some of those may occasionally be of use.
The history object provides the ability to move to different pages in the browser history. However, its use is limited, because you can't see what is actually in the history -- just how many pages are in the history.
The size of your visitor's screen is not a very useful piece of information. Fortunately browsers provide a way to find out what space is left after taking fixed toolbars into account. The information is still only useful for when your visitor allows you to open a new window, though.
The navigator object is the least useful of the Browser Object Model available on all browsers. Different browsers implement different properties on this object to hold the same information. This means it's necessary to test multiple properties to see which is supported.
Moving on from common but not very useful BOM objects and the most useful BOM data that needs to be accessed in different ways depending on the browser is the available width and height in the viewport. All of your animations will need this information, in order to know how far they can move while remaining visible.
Most browsers provide a way to retrieve the coordinates of where the mouse cursor is pointing within the page -- they just don't provide the same way of accessing it. We can set up simple functions to provide common calls that we can use that work cross browser.
The distance that the current page has been scrolled in the browser viewport is yet another pair of values where we require functions to provide us with cross browser support. Most do support a common call to actually scroll the page to a specified location.