O'Reilly logo

Learning JavaScript 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. The Basic Browser Objects

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

We’ve worked with some of the objects—window, document, navigator, and form—in earlier chapters. This chapter looks at these in more detail, as well as the other objects that complete the set.

BOM at a Glance

The BOM forms a hierarchy of objects, with each object at each level accessible via a parent object above it. All of the elements of the BOM are accessible via the window, which is the topmost element. The next level below features document, which we’ve used extensively. The level also contains the navigator, frames, location, history, and screen objects. From the document, several collections of objects are accessible: forms, anchors, links, and images. As demonstrated in Chapter 3, the form itself has elements, but we’ll stop at just the top three levels in this chapter.

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

Hierarchy of the Browser Object Model

Figure 9-1. Hierarchy of the Browser Object Model

As can be quickly seen, window is the top dog in this bunch. ...

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