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
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_nameExample:
<script language="JavaScript"> window.open("//www.geeksforgeeks.org") "Opening GeeksforGeeks Home page"; <body onload="showstatus()"> <input type="button" name="btn" value="Open GeeksforGeeks" |
Output:
Before Click the Button:
After Click the button:
Article Tags :
- Article
- 04/30/2022
- 2 minutes to read
Applies to:
The Properties window is used to display properties for objects selected in the two main types of windows available in the Visual Studio integrated development environment (IDE). These two types of windows are:
Tool windows such as Solution Explorer, Class View, and Object browser
Document windows containing such editors and designers as the forms designer, XML editor, and HTML editor
Using the Properties Window
The Properties window displays the properties of single or multiple selected items. If multiple items are selected, the intersection of all properties for all selected objects is displayed.
Events related to a selected object within a form design window or HTML editor using COM+ metadata are displayed in the Properties window. For example, you can select a button and display its associated events, such as an OnClick event, which can be linked to that button.
Events displayed in the Properties window are primarily used with objects that are bound to code. If you are editing a file format that does not have anything to do with code, you are not going to have any events. Events are only displayed in the Properties window when there is a binding between running code and certain events associated with specific objects. An example of this would be code behind a selected object that executes when that object is activated.
The following table lists the primary interfaces used by the Properties window.
ICategorizeProperties | Provides a list of categories to the Properties window and maps each property to a category. |
IDispatch Interface | Exposes an object's methods and properties to programming tools and other applications that support automation. |
IProvidePropertyBuilder | Provides ellipsis (...) buttons called builders that open modal dialog windows implemented by the object itself. Used when a value is not easily typed by the user in a text field. For example, it might be used to open a color picker that determines the RGB value for you. |
ISelectionContainer | Provides access to objects used to update information displayed in the Properties window. ISelectionContainer is implemented by VSPackages for each window that contains selectable objects with related properties to be displayed. |
ITypeInfo | Provides information about the type of an object such as methods of an interface and fields of a structure. |
IVsMonitorSelection | Enables VSPackages to receive notification of selection events and to retrieve information about the current project hierarchy, item, element value, and command UI context. |
IVsMultiItemSelect | Provides the environment with access to multiple selections. |
IVsPerPropertyBrowsing | Used to provide localized names on some properties displayed in the Properties window. |
IVsSelectionEvents | Notifies registered VSPackages of changes to the current selection, element value, or command UI context. |
IVsTrackSelectionEx | Notifies the environment of a change in the current selection and provides access to hierarchy and item information relating to the new selection. |
For further information on IDispatch, see the MSDN library.
See also
- Extending Properties
- Properties Window Fields and Interfaces