Loading
Window Object-tutorial
In JavaScript, the window object represents the web browser’s window or tab where the script runs.
It acts as the global object and provides access to various browser-related properties and methods to interact with the page, navigate, and get browser details.



Key Properties of the Window Object


window.document

Accesses the current web page’s DOM (Document Object Model) to manipulate HTML and content dynamically.



window.location

Represents the current URL and lets you get or change parts like hostname, pathname, and query parameters.



window.navigator

Contains information about the user’s browser, such as name, version, platform, and user agent.



window.history

Provides methods to navigate backward and forward through the browser’s session history.



Methods of Window Object

The window object offers many built-in methods to control and interact with browser features, such as

  • alert(), confirm(), prompt()
  • open(), close()
  • setTimeout(), setInterval()