Open In App

Properties of Window Object

Improve
Improve
Like Article
Like
Save
Share
Report

The window object is the topmost object of DOM hierarchy. It represents a browser window or frame that displays the contents of the webpage. Whenever a window appears on the screen to display the contents of document, the window object is created. The properties and methods of Window object that are commonly used are listed in the below table:

Properties of the Window Object

Property Name

Purpose

Closed It holds a Boolean value that represents whether the window is closed or not.
console It returns a reference to the console object which provides access to the browser’s debugging console.
defaultStatus It is used to define the default message that will be displayed in the status bar when no activity is carried on by the browser.
controllers It returns the XUL controller objects for the current Chrome window.
customElements It returns a reference to the CustomElementRegistry object, which can be used to register new custom elements and also get information about already registered custom elements.
crypto It returns the browser crypto object.
devicePixelRatio It returns the ratio between physical pixels and device independent pixels in the current display.
Document It returns a reference to the document object of that window.
DOMMatrix It returns a reference to a DOMMatrix object, which represents 4×4 matrices, suitable for 2D and 3D operations.
frames[] It represents an array that contains all the frames of a given window.
DOMPoint It returns a reference to a DOMPoint object, which represents a 2D or 3D point in a coordinate system.
History It provides information of the URLs visited in the current window.
Length It represents the number of frames in the current window.
DOMRect It returns a reference to a DOMRect object, which represents a rectangle.
fullScreen This property indicates whether the window is displayed in full screen or not.
Location It contains the URL of the current window.
innerHeight It is used to get the height of the content area of the browser window.
innerWidth It is used to get the width of the content area of the browser window.
Name It contains name of the referenced window.
Opener It contains a reference to the window that opened the current window.
Parent It refers to the frame set in which the current frame is contained.
Screen It refers to the screen object
Self It provides another way to refer the current window.
Status It overrides the defaultStatus and places a message in the status bar.
Top It returns a reference to the topmost window containing a frame if many windows are opened.
Window It returns the current window or frame.
Navigator It returns a reference to the navigator object.
outerHeight It will get height of the outside of the browser window.
outerWidth It will get width of the outside of the browser window.
Toolbar It will result the toolbar object, whose visibility can be toggled in the window.

To access the properties of the window object, you will specify object name followed by a period symbol (.) and the property name. 
 

Syntax:

window.property_name

Example:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <script language="JavaScript">
        function winopen() {
            window.open("https://www.geeksforgeeks.org")
        }
        function showstatus() {
            window.status =
                "Opening GeeksforGeeks Home page";
        }
    </script>
</head>
 
<body onload="showstatus()">
    <input type="button" name="btn"
        value="Open GeeksforGeeks"
        onclick="winopen()">
</body>
 
</html>


Output:

Before Click the Button:

After Click the button:



Last Updated : 31 Aug, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads