O'Reilly logo

Learning JavaScript, 2nd Edition by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Browser As Puzzle Box

The Browser Object Model (BOM) is a set of objects inherited from the browser context in which most JavaScript applications function. Sometimes referred to as the Document Object Model (DOM) Level 0, or even as the DOM, the BOM is a finite set of common web objects that have been accessible via JavaScript since earlier versions of Netscape Navigator and Microsoft’s Internet Explorer.

Previous chapters demonstrated some of the objects, such as window, document, and form. This chapter looks at these objects more closely, as well as the other objects that complete the BOM.

The Structure of the Browser at a Glance

The BOM forms a hierarchy of objects, with objects at each level accessible via parent objects above them. You can access all of the elements of the BOM via window, which is the topmost element. The next level below features document, the object used most often in previous examples. The level also contains the navigator, frames, location, history, and screen objects. From the document, several collections of objects are accessible: forms, anchors, links, cookies, and images. As I demonstrated in Chapter 8, the form object also has collections of elements as children.

Figure 9-1 shows the BOM at a glance, and how all of these elements relate to each other.

Hierarchy of the BOM

Figure 9-1. Hierarchy of the BOM

An object property can be a single object that may or may not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required