javscJavaScript Browser BOM (Browser Object Model): An Overview

habtesoft
3 min readDec 2, 2024

The Browser Object Model (BOM) in JavaScript refers to the set of objects provided by the browser to interact with the browser environment outside of the webpage’s content. While the Document Object Model (DOM) handles the content of a webpage, the BOM allows developers to control the browser itself.

Not a Medium member? Read this article here

Key Components of BOM

  1. window Object
    The global object representing the browser window. All BOM properties and methods are accessed through window.

Example:

console.log(window.innerWidth); // Width of the browser's viewport
alert("Hello, BOM!"); // Displays an alert box

2. navigator Object
Provides information about the browser and operating system.
Example:

console.log(navigator.userAgent); // Details about the browser and OS
console.log(navigator.language); // Language setting of the browser

3. screen Object
Gives information about the user's screen properties, such as resolution and color depth.
Example:

console.log(screen.width);  // Width…

--

--

habtesoft
habtesoft

Written by habtesoft

Passionate JavaScript developer with a focus on backend technologies. Always eager to connect and learn. Let’s talk, https://buymeacoffee.com/habtesoftat

No responses yet