Window Object Properties

The Window object in JavaScript has numerous properties that provide access to various aspects of the browser environment and the window itself. Some commonly used properties include:

Property Name

Description

window.documentThe HTML document that is shown in the window is represented by the Document object, which is referred to by the document property.
window.consoleThe console gives the window’s Console Object back.
window.locationThe location attribute makes reference to the Location object, which has data about the page’s current URL.
window.defaultStatusIt is now Abandoned.
window.closedIf a window is closed, it returns a true boolean value.
window.frameElementIt gives the window’s current frame back.
window.framereturns every window item currently active in the window.
window.historyRetrieves the window’s History object.
window.lengthIt gives the number of iframe> elements currently present in the window.
window.localStorageprovides the ability to store key/value pairs in a web browser. stores data without a time.
window.innerWidth and window.innerHeightWithout including the toolbars and scrollbars, these characteristics describe the width & height of the browser window.
window.openerIt returns a pointer to the window that created the window in the opener function.
window.outerHeightYou can use outerHeight to return the height of the browser window, including toolbars and scrollbars.
window.outerWidthYou can outerWidth to get the width of the browser window, including toolbars and scrollbars.
window.nameReturns or sets a window’s name.
window.parentBrings up the current window’s parent window.
window.sessionStorageProvides the ability to store key/value pairs in a web browser. Contains data for a single session.
window.scrollXIt is a pageXOffset alias.
window.scrollYIt is a pageYOffset alias.
window.selfIt provides the window’s current state.
window.statusIt is now Deprecated. Don’t employ it.
window.topIt provides the top-most browser window back.
window.screenThe screen attribute makes reference to the Screen object, which stands in for the screen that the browser is shown on.
window.historyThe History object, which includes details about the current page’s browsing history, is the subject of the history property.
window.pageXOffsetThe number of pixels that the current document has been scrolled horizontally.
window.pageYOffsetThe number of pixels that the current document has been scrolled vertically.
window.screenLeft:The x-coordinate of the current window relative to the screen.
window.screenTopThe y-coordinate of the current window relative to the screen.
window.screenXThe x-coordinate of the current window relative to the screen (deprecated).
window.screenYThe y-coordinate of the current window relative to the screen (deprecated).
window.navigatorAn object representing the browser and its capabilities

Window Object in JavaScript

In JavaScript, the Window object represents the window that contains a DOM document.

The Window object provides access to various properties and methods that enable interaction with the browser environment, including manipulating the document, handling events, managing timers, displaying dialog boxes, and more.

Similar Reads

Window Object Properties

The Window object in JavaScript has numerous properties that provide access to various aspects of the browser environment and the window itself. Some commonly used properties include:...

Window Object Properties Examples

Example 1: We will use the console property in this example to show how it works....

Window Object Methods:

A method in JavaScript is a function connected to an object. You may conduct operations or compute values by calling methods on objects....

Conclusion:

The window object in JavaScript represents the browser window or frame. It offers properties like innerHeight, innerWidth, screen, and methods like alert(), confirm(), open(), enabling interaction and control over the window and document....

Contact Us