Browser Object Model Core Objects and Functionality Analysis

The Browser Object Model (BOM) in JavaScript refers to a set of APIs used to represent and manipulate browser windows and screens. The BOM is not a standard defined by W3C but is instead defined and implemented independently by browser vendors.

The BOM provides a hierarchical set of objects, including the window object, navigator object, screen object, history object, and location object, among others. The window object serves as the core object of the BOM, representing the browser window or frame, and offers a suite of methods and properties for controlling and manipulating window size, position, opening new windows, closing windows, and more.

For example, to open a new window, you can use the following code:

// Open a new window
var newWindow = window.open("http://www.example.com", "example", "width=400,height=300");
// Close the new window
newWindow.close();

Additionally, the BOM provides other objects such as the navigator object, which can retrieve browser name, version, and operating system information; the screen object, which can obtain screen width, height, color depth, and so on; the history object, which allows manipulation of the browser's history; and the location object, which can access the URL of the current document.

For example, to retrieve the URL of the current document, you can use the following code:

// Retrieve the URL of the current document
var currentURL = location.href;