May 06, 2021 JavaScript
The Browser Object Model (BOM) enables JavaScript to "talk" to the browser.
The Window object is the core of all objects in the BOM and contains some window control functions in addition to the parent of all objects in the BOM.
There is no official standard for browser object models (B rowser O bject M odel (BOM).
Because modern browsers have (almost) implemented the same methods and properties in terms of JavaScript interactivity, they are often considered bom methods and properties.
Window objects are supported by all browsers. It represents the browser window.
All JavaScript global objects, functions, and variables automatically become members of the window object.
The global variable is a property of the window object.
The global function is the method of the window object.
Even the document of html DOM is one of the properties of the window object:
Same as this:
Window's sub-objects are mainly as follows:
There are three ways to determine the size of a browser window (browser window, excluding toolbars and scroll bars).
For Internet Explorer, Chrome, Firefox, Opera, and Safari:
For Internet Explorer 8, 7, 6, 5:
Or
Practical JavaScript scenarios (covering all browsers):
This example shows the height and width of the browser window: (excluding toolbar/scroll bar)
Some other methods: