loader

Loading

CoderrShyam logo

CoderrShyam

HomeAboutContactBlogTutorials
LoginSignup

Introduction

Quick StartWhat is JavaScriptHistory of JavaScript

Setup

Node.js InstallationVisual Studio Code

Basics

Syntax & Comments
Variables
Functions

Advanced

Window ObjectHistory ObjectNavigator ObjectScreen ObjectDocument ObjectsgetElementById MethodgetElementsByClassName MethodgetElementsByName MethodgetElementsByTagName MethodinnerHTMLouterHTML
CoderrShyam logo

CoderrShyam

HomeAboutContactBlogTutorials
LoginSignup
TutorialsJavaScript TutorialDom bomWindow Object

Window Object

In this tutorial, we will learn about the Window object in JavaScript.

In JavaScript, the window object represents the current browser window or tab that is open in a web browser. It is a global object that provides access to various properties and methods related to the browser window. The window object is automatically created by the browser and is available to all JavaScript code running in the browser.

Accessing the Window Object

You can access the window object in JavaScript using the window keyword. For example, you can use the window object to get the current URL of the browser window:

let currentURL = window.location.href;
console.log(currentURL);

This will output the current URL of the browser window.

Properties of the Window Object

The window object has many properties that provide information about the browser window. Some of the commonly used properties are:

  • window.location: Provides information about the current URL of the browser window.
  • window.document: Represents the document object of the current web page.
  • window.navigator: Provides information about the browser and the operating system.
  • window.screen: Provides information about the screen size and resolution.
  • window.history: Provides access to the browser's history stack.

You can access these properties using the window object. For example, to get the current URL of the browser window, you can use window.location.href.

Methods of the Window Object

The window object also has many methods that allow you to interact with the browser window. Some of the commonly used methods are:

  • window.alert(): Displays an alert dialog box with a message and an OK button.
  • window.prompt(): Displays a dialog box that prompts the user for input.
  • window.confirm(): Displays a dialog box with a message and OK/Cancel buttons.

You can call these methods using the window object. For example, to display an alert dialog box, you can use window.alert('Hello, World!').

Conclusion

  • The window object represents the current browser window or tab in JavaScript.
  • You can access the window object using the window keyword.
  • The window object has many properties and methods that allow you to interact with the browser window.

How is this guide?

February 26th, 2026

Boolean in JavaScript

In this tutorial, we will learn how to work with booleans in JavaScript using the Boolean object.

History Object

In this tutorial, we will learn about the History object in JavaScript.

© 2026CoderrShyamAll Rights Reserved.

On this page

Accessing the Window Object
Properties of the Window Object
Methods of the Window Object
Conclusion
Follow us on GitHub