01-06 Window Object
01-06 Window Object
Window Object
Window OBJECT
In JavaScript, the window object is fundamental part of browser environment.
It represents the browser window or tab.
It is the global object in the browser for the code running in the browser.
All global variables, functions, and objects are the properties of the window object.
It provides numerous properties, methods and events to interact with the browser and the
webpage.
Window Object Properties
o Some key properties of the window object include:
Property Name Description
window.document Represents the Document Object Model (DOM) of the
current webpage. Allows interaction with HTML elements.
window.innerWidth The inner dimensions of the browser's window (viewport).
window.innerHeight
window.location Contains information about the current URL. It can be used
to redirect users, get the URL, or manipulate it.
window.history Provides access to the browser’s session history (e.g.,
back, forward navigation)
window.navigator Contains information about the browser environment (e.g.,
user-agent, platform)
window.screen Provides information about the user’s screen (e.g., screen
width, height)