01. The Browser Object Model

JavaScript's power and flexibility comes from its ability to access and manipulate objects that are native to the browser environment.

The collection of these objects is known as the Browser Object Model (BOM). The BOM is a tree-like hierarchy of objects, each with useful access properties and methods. Essentially, this object allows you to talk with your user's browser.

Functions include querying the the browser window size, the main heading of the page, a pointer to the last page in a user's history and more!

Elements of the Browser Object Model

The BOM's root is the window object, which displays properties of the current open window or tab. It has several children, most of which we'll cover in this section.

JavaScript BOM tree

Here is a brief description of each element on the tree.

document
Contains all HTML elements of the current page.
frames
Any frames embedded within the current page.
history
Contains a stack of sites visited in the current session.
location
Stores URL of the current page.
navigator
Stores information about the browser being used, and the OS used by the browser.
screen
Display properties of the user's computer or device.

Because the document element has much to cover, it deserves its own section; we'll cover the other elements here, starting with the window object.

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Ad