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.document | The HTML document that is shown in the window is represented by the Document object, which is referred to by the document property. |
window.console | The console gives the window’s Console Object back. |
window.location | The location attribute makes reference to the Location object, which has data about the page’s current URL. |
window.defaultStatus | It is now Abandoned. |
window.closed | If a window is closed, it returns a true boolean value. |
window.frameElement | It gives the window’s current frame back. |
window.frame | returns every window item currently active in the window. |
window.history | Retrieves the window’s History object. |
window.length | It gives the number of iframe> elements currently present in the window. |
window.localStorage | provides the ability to store key/value pairs in a web browser. stores data without a time. |
window.innerWidth and window.innerHeight | Without including the toolbars and scrollbars, these characteristics describe the width & height of the browser window. |
window.opener | It returns a pointer to the window that created the window in the opener function. |
window.outerHeight | You can use outerHeight to return the height of the browser window, including toolbars and scrollbars. |
window.outerWidth | You can outerWidth to get the width of the browser window, including toolbars and scrollbars. |
window.name | Returns or sets a window’s name. |
window.parent | Brings up the current window’s parent window. |
window.sessionStorage | Provides the ability to store key/value pairs in a web browser. Contains data for a single session. |
window.scrollX | It is a pageXOffset alias. |
window.scrollY | It is a pageYOffset alias. |
window.self | It provides the window’s current state. |
window.status | It is now Deprecated. Don’t employ it. |
window.top | It provides the top-most browser window back. |
window.screen | The screen attribute makes reference to the Screen object, which stands in for the screen that the browser is shown on. |
window.history | The History object, which includes details about the current page’s browsing history, is the subject of the history property. |
window.pageXOffset | The number of pixels that the current document has been scrolled horizontally. |
window.pageYOffset | The 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.screenTop | The y-coordinate of the current window relative to the screen. |
window.screenX | The x-coordinate of the current window relative to the screen (deprecated). |
window.screenY | The y-coordinate of the current window relative to the screen (deprecated). |
window.navigator | An 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.
Contact Us