Skip to content

Chapter 27 of 33

Browser DOM and BOM

Understand document, window, navigation, history, location, and capability interfaces.

38 minutes 10 quick checksBy Subha Prasad
Lesson 27 of 33Course navigation

Lesson content

Read, practise, then check your understanding

window represents a browsing context and commonly acts as the global object for classic scripts. document exposes the DOM. The BOM includes location, history, navigator, screen, timers, and related host facilities.

Navigation state

const url = new URL(location.href);
url.searchParams.set("chapter", "arrays");
history.pushState({ chapter: "arrays" }, "", url);

addEventListener("popstate", event => restore(event.state));

History APIs change session entries, not server data. Capability detection is better than user-agent sniffing. Respect same-origin rules, permissions, lifecycle events, accessibility, and back-button expectations. Browser APIs may be absent in workers, servers, tests, or older clients, so isolate host-dependent code.

Knowledge check

Answer every question correctly to complete this chapter.

Which statement best describes document?
Which JavaScript term matches this description: The DOM entry point for the current page.
Which statement best describes window?
Which JavaScript term matches this description: The browser global object for a browsing context.
Which statement best describes location?
Which JavaScript term matches this description: The BOM interface representing and navigating the current URL.
Which statement best describes history?
Which JavaScript term matches this description: The BOM interface for session navigation state.
Which statement best describes navigator?
Which JavaScript term matches this description: An interface exposing selected browser and platform capabilities.

0 of 10 checks passed

Your progress is saved on this device.