Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Properties of Window Object

  • Last Updated : 31 Aug, 2021

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

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Property Name

Purpose

ClosedIt holds a Boolean value that represents whether the window is closed or not.
consoleIt returns a reference to the console object which provides access to the browser’s debugging console.
defaultStatusIt is used to define the default message that will be displayed in the status bar when no activity is carried on by the browser.
controllersIt returns the XUL controller objects for the current Chrome window.
customElementsIt 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.
cryptoIt returns the browser crypto object.
devicePixelRatioIt returns the ratio between physical pixels and device independent pixels in the current display.
DocumentIt returns a reference to the document object of that window.
DOMMatrixIt 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.
DOMPointIt returns a reference to a DOMPoint object, which represents a 2D or 3D point in a coordinate system.
HistoryIt provides information of the URLs visited in the current window.
LengthIt represents the number of frames in the current window.
DOMRectIt returns a reference to a DOMRect object, which represents a rectangle.
fullScreenThis property indicates whether the window is displayed in full screen or not.
LocationIt contains the URL of the current window.
innerHeightIt is used to get the height of the content area of the browser window.
innerWidthIt is used to get the width of the content area of the browser window.
NameIt contains name of the referenced window.
OpenerIt contains a reference to the window that opened the current window.
ParentIt refers to the frame set in which the current frame is contained.
ScreenIt refers to the screen object
SelfIt provides another way to refer the current window.
StatusIt overrides the defaultStatus and places a message in the status bar.
TopIt returns a reference to the topmost window containing a frame if many windows are opened.
WindowIt returns the current window or frame.
NavigatorIt returns a reference to the navigator object.
outerHeightIt will get height of the outside of the browser window.
outerWidthIt will get width of the outside of the browser window.
ToolbarIt 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:




My Personal Notes arrow_drop_up
Recommended Articles
Page :