JavaScript BOM (Browser Object Model)
There are no official standards for the Browser Object Model (BOM), but modern browsers have implemented (almost) the same methods and properties for JavaScript interactivity.
The Window Object
The window object is supported by all browsers. It represents the browser's window. All global JavaScript objects, functions, and variables automatically become members of the window object. Even the document object (of the HTML DOM) is a property of the window object!
window.innerHeight- the inner height of the browser windowwindow.innerWidth- the inner width of the browser window
Location Object
The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.
location.hrefreturns the href (URL) of the current pagelocation.hostnamereturns the domain name of the web hostlocation.assign()loads a new document
History Object
The window.history object contains the browsers session history. To protect the privacy of the users, there are strict limitations on how JavaScript can access this object.
history.back()- equivalent to clicking back in the browserhistory.forward()- equivalent to clicking forward in the browser
View Additional BOM Objects+
Navigator: The window.navigator object contains information about the visitor's browser (e.g., navigator.appName, navigator.userAgent).
Screen: The window.screen object contains information about the visitor's screen (e.g., screen.width, screen.height).
Popups: JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box. They are all methods of the window object.
