Loading

Browser Objects

  • In JavaScript, "BOM" stands for "Browser Object Model." The Browser Object Model is a collection of objects provided by web browsers to interact with and control the browser itself.
  • The BOM allows you to perform various tasks related to the browser window, history, location, and more.

 Using the BOM to open a new browser window:

// Open a new browser window with Google as the URL
var newWindow = window.open("https://www.google.com", "Google", "width=800, height=600");

key objects and features of the BOM in JavaScript:

Window Object:

  •  The window object represents the browser window or tab and serves as the entry point to the BOM.

Location Object:

  •  The location object contains information about the current URL and allows you to manipulate the URL to navigate to different web pages
  • You can access properties like location.href, location.hostname, and location.pathname.

History Object:

  •  The history object allows you to interact with the browser's history.

Navigator Object: 

  • The navigator object provides information about the user's browser and operating system.

Screen Object:

  •  The screen object contains information about the user's screen or monitor.