The browser provides us with a hierarchy of objects which we can use to control and access various information about time, screen, page, elements on a page etc.
The global structure
The browser provides access to a large hierarchy of objects for developers to manipulate. You can see a part of it below:
On the top is the
window, also called global object.
All other objects form 3 groups.
- Document Object Model (DOM)
documentand related objects allow to access contents of the page, modify elements etc. Most interaction with HTML is handled here.
There is a pack of standards for DOM, developed by W3C. You can find it at W3C DOM page. There are three levels of DOM, each level expands on the previous. Modern browsers generally support pre-W3C features from the browser dark-ages, called DOM 0.
- Browser Object Model (BOM)
- BOM is a pack of objects that allow to control the browser, e.g change current URL, access frames, do background requests to server with XMLHttpRequest etc. Functions like
alert,confirm,promptalso belong BOM, they are provided by the browser.
Many BOM features are standartized in HTML5, but not all.
window object mixes browser window functionality (methods
While this information is theoretical, the terms are always good to know.
It is advisable that you read DOM and other standards as it helps when problem solving and serves general educational purposes.
And, by the way, the components can be used separately.
- DOM is also used for XML documents, not just HTML, and of course not limited to frontend programming.