Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1047060 of Window

  • Revision slug: Web/API/Window
  • Revision title: Window
  • Revision id: 1047060
  • Created:
  • Creator: jpmedley
  • Is current revision? No
  • Comment Add to an event description.

Revision Content

{{APIRef}}

The window object represents a window containing a DOM document; the document property points to the DOM document loaded in that window. A window for a given document can be obtained using the {{Domxref("document.defaultView")}} property.

This section provides a brief reference for all of the methods, properties, and events available through the DOM window object. The window object implements the Window interface, which in turn inherits from the AbstractView interface. Some additional global functions, namespaces, objects, interfaces, and constructors, not typically associated with the window, but available on it, are listed in the JavaScript Reference and DOM Reference.

In a tabbed browser, such as Firefox, each tab contains its own window object (and if you're writing an extension, the browser window itself is a separate window too - see Working with windows in chrome code for more information). That is, the window object is not shared between tabs in the same window. Some methods, namely {{Domxref("window.resizeTo")}} and {{Domxref("window.resizeBy")}} apply to the whole window and not to the specific tab the window object belongs to. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.

Properties

This interface inherits properties from the {{domxref("EventTarget")}} interface and implements properties from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.

Note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below.

{{domxref("Window.applicationCache")}}  {{readOnlyInline}} {{gecko_minversion_inline("1.9")}}
An {{domxref("OfflineResourceList")}} object providing access to the offline resources for the window.
{{domxref("Window.caches")}} {{readOnlyInline}}
Returns the {{domxref("CacheStorage")}} object associated with the current origin. This object enables service worker functionality such as storing assets for offline use, and generating custom responses to requests.
{{domxref("Window.closed")}} {{Non-standard_inline}}{{readOnlyInline}}
This property indicates whether the current window is closed or not.
Window.Components {{Non-standard_inline}}
The entry point to many XPCOM features. Some properties, e.g. classes, are only available to sufficiently privileged code. Web code should not use this property.
{{domxref("console","Window.console")}} {{Non-standard_inline}} {{ReadOnlyInline}}
Returns a reference to the console object providing access to the browser's debugging console.
{{domxref("Window.content")}} and Window._content {{Non-standard_inline}} {{obsolete_inline}}{{ReadOnlyInline}}
Returns a reference to the content element in the current window. The obsolete variant with underscore is no longer available from Web content.
{{domxref("Window.controllers")}}{{non-standard_inline}}{{ReadOnlyInline}}
Returns the XUL controller objects for the current chrome window.
{{domxref("Window.crypto")}} {{readOnlyInline}}
Returns the browser crypto object.
{{domxref("Window.defaultStatus")}} {{Obsolete_inline("gecko23")}}
Gets/sets the status bar text for the given window.
{{domxref("Window.devicePixelRatio")}} {{non-standard_inline}}{{ReadOnlyInline}}
Returns the ratio between physical pixels and device independent pixels in the current display.
{{domxref("Window.dialogArguments")}} {{Fx_minversion_inline(3)}} {{ReadOnlyInline}}
Gets the arguments passed to the window (if it's a dialog box) at the time {{domxref("window.showModalDialog()")}} was called. This is an {{Interface("nsIArray")}}.
{{domxref("Window.directories")}} {{obsolete_inline}}
Synonym of {{domxref("window.personalbar")}}
{{domxref("Window.document")}} {{ReadOnlyInline}}
Returns a reference to the document that the window contains.
{{domxref("Window.frameElement")}} {{readOnlyInline}}
Returns the element in which the window is embedded, or null if the window is not embedded.
{{domxref("Window.frames")}} {{readOnlyInline}}
Returns an array of the subframes in the current window.
{{domxref("Window.fullScreen")}} {{gecko_minversion_inline("1.9")}}
This property indicates whether the window is displayed in full screen or not.
{{domxref("Window.globalStorage")}} {{gecko_minversion_inline("1.8.1")}} {{Non-standard_inline}} {{Obsolete_inline("gecko13")}}
Unsupported since Gecko 13 (Firefox 13). Use {{domxref("Window.localStorage")}} instead.
Was: Multiple storage objects that are used for storing data across multiple pages.
{{domxref("Window.history")}} {{ReadOnlyInline}}
Returns a reference to the history object.
{{domxref("Window.innerHeight")}}
Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
{{domxref("Window.innerWidth")}}
Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
{{domxref("Window.isSecureContext")}} {{readOnlyInline}}
Indicates whether a context is capable of using features that require secure contexts.
{{domxref("Window.length")}} {{readOnlyInline}}
Returns the number of frames in the window. See also {{domxref("window.frames")}}.
{{domxref("Window.location")}} {{ReadOnlyInline}}
Gets/sets the location, or current URL, of the window object.
{{domxref("Window.locationbar")}} {{ReadOnlyInline}}
Returns the locationbar object, whose visibility can be toggled in the window.
{{domxref("Window.localStorage")}} {{readOnlyInline}}{{gecko_minversion_inline("1.9.1")}}
Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
{{domxref("Window.menubar")}} {{ReadOnlyInline}}
Returns the menubar object, whose visibility can be toggled in the window.
{{domxref("Window.messageManager")}} {{gecko_minversion_inline("2.0")}}
Returns the message manager object for this window.
{{domxref("Window.mozAnimationStartTime")}} {{ReadOnlyInline}}{{gecko_minversion_inline("2.0")}}
The time in milliseconds since epoch at which the current animation cycle began.
{{domxref("Window.mozInnerScreenX")}} {{ReadOnlyInline}}{{non-standard_inline}}{{gecko_minversion_inline("1.9.2")}}
Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in {{interface("nsIDOMWindowUtils")}} for a conversion factor to adapt to screen pixels if needed.
{{domxref("Window.mozInnerScreenY")}} {{ReadOnlyInline}} {{non-standard_inline}}{{gecko_minversion_inline("1.9.2")}}
Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed.
{{domxref("Window.mozPaintCount")}} {{non-standard_inline}}{{ReadOnlyInline}} {{gecko_minversion_inline("2.0")}}
Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.
{{domxref("Window.name")}}
Gets/sets the name of the window.
{{domxref("Window.navigator")}} {{readOnlyInline}}
Returns a reference to the navigator object.
{{domxref("Window.opener")}}
Returns a reference to the window that opened this current window.
{{domxref("Window.orientation")}}{{non-standard_inline}}{{deprecated_inline}}{{readOnlyInline}}
Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
{{domxref("Window.outerHeight")}} {{readOnlyInline}}
Gets the height of the outside of the browser window.
{{domxref("Window.outerWidth")}} {{readOnlyInline}}
Gets the width of the outside of the browser window.
{{domxref("Window.scrollX","Window.pageXOffset")}} {{readOnlyInline}}
An alias for {{domxref("window.scrollX")}}.
{{domxref("Window.scrollY","Window.pageYOffset")}}{{readOnlyInline}}
An alias for {{domxref("window.scrollY")}}
{{domxref("Window.sessionStorage")}} {{readOnlyInline}}
Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
{{domxref("Window.parent")}} {{readOnlyInline}}
Returns a reference to the parent of the current window or subframe.
{{domxref("Window.performance")}} {{readOnlyInline}}
Provides a hosting area for performance related attributes.
{{domxref("Window.personalbar")}} {{readOnlyInline}}
Returns the personalbar object, whose visibility can be toggled in the window.
{{domxref("Window.pkcs11")}} {{obsolete_inline(29)}}
Formerly provided access to install and remove PKCS11 modules.
{{domxref("Window.returnValue")}} {{Fx_minversion_inline(3)}}
The return value to be returned to the function that called {{domxref("window.showModalDialog()")}} to display the window as a modal dialog.
{{domxref("Window.screen")}} {{readOnlyInline}}
Returns a reference to the screen object associated with the window.
{{domxref("Window.screenX")}} {{readOnlyInline}}
Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
{{domxref("Window.screenY")}} {{readOnlyInline}}
Returns the vertical distance of the top border of the user's browser from the top side of the screen.
{{domxref("Window.scrollbars")}} {{readOnlyInline}}
Returns the scrollbars object, whose visibility can be toggled in the window.
{{domxref("Window.scrollMaxX")}}{{non-standard_inline}}{{ReadOnlyInline}}
The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
{{domxref("Window.scrollMaxY")}}{{non-standard_inline}}{{ReadOnlyInline}}
The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
{{domxref("Window.scrollX")}} {{readOnlyInline}}
Returns the number of pixels that the document has already been scrolled horizontally.
{{domxref("Window.scrollY")}} {{readOnlyInline}}
Returns the number of pixels that the document has already been scrolled vertically.
{{domxref("Window.self")}} {{ReadOnlyInline}}
Returns an object reference to the window object itself.
{{domxref("Window.sessionStorage")}} {{Fx_minversion_inline("2.0")}}
Returns a storage object for storing data within a single page session.
{{domxref("Window.sidebar")}} {{non-standard_inline}}{{ReadOnlyInline}}
Returns a reference to the window object of the sidebar.
{{domxref("Window.speechSynthesis")}} {{ReadOnlyInline}}
Returns a {{domxref("SpeechSynthesis")}} object, which is the entry point into using Web Speech API speech synthesis functionality.
{{domxref("Window.status")}}
Gets/sets the text in the statusbar at the bottom of the browser.
{{domxref("Window.statusbar")}} {{readOnlyInline}}
Returns the statusbar object, whose visibility can be toggled in the window.
{{domxref("Window.toolbar")}} {{readOnlyInline}}
Returns the toolbar object, whose visibility can be toggled in the window.
{{domxref("Window.top")}} {{readOnlyInline}}
Returns a reference to the topmost window in the window hierarchy. This property is read only.
{{domxref("Window.window")}} {{ReadOnlyInline}}
Returns a reference to the current window.
window[0], window[1], etc.
Returns a reference to the window object in the frames. See {{domxref("Window.frames")}} for more details.

Methods

This interface inherits methods from the {{domxref("EventTarget")}} interface and implements methods from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, {{domxref("WindowEventHandlers")}}, and {{domxref("GlobalFetch")}}.

{{domxref("EventTarget.addEventListener()")}}
Register an event handler to a specific event type on the window.
{{domxref("Window.alert()")}}
Displays an alert dialog.
{{domxref("WindowBase64.atob()")}}
Decodes a string of data which has been encoded using base-64 encoding.
{{domxref("Window.back()")}} {{Non-standard_inline}} {{obsolete_inline}}
Moves back one in the window history.
{{domxref("Window.blur()")}}
Sets focus away from the window.
{{domxref("WindowBase64.btoa()")}}
Creates a base-64 encoded ASCII string from a string of binary data.
{{domxref("Window.cancelIdleCallback()")}} {{experimental_inline}}
Enables you to cancel a callback previously scheduled with {{domxref("Window.requestIdleCallback")}}.
{{domxref("Window.captureEvents()")}} {{Deprecated_inline}}
Registers the window to capture all events of the specified type.
{{domxref("Window.clearImmediate()")}}
Cancels the repeated execution set using setImmediate.
{{domxref("WindowTimers.clearInterval()")}}
Cancels the repeated execution set using {{domxref("WindowTimers.setInterval()")}}.
{{domxref("WindowTimers.clearTimeout()")}}
Cancels the repeated execution set using {{domxref("WindowTimers.setTimeout()")}}.
{{domxref("Window.close()")}}
Closes the current window.
{{domxref("Window.confirm()")}}
Displays a dialog with a message that the user needs to respond to.
{{domxref("Window.disableExternalCapture()")}} {{obsolete_inline(24)}}
{{todo("NeedsContents")}}
{{domxref("Window.dispatchEvent()")}}
Used to trigger an event.
{{domxref("Window.dump()")}}
Writes a message to the console.
{{domxref("Window.enableExternalCapture()")}} {{obsolete_inline(24)}}
{{todo("NeedsContents")}}
{{domxref("GlobalFetch.fetch()")}}
Starts the process of fetching a resource.
{{domxref("Window.find()")}}
Searches for a given string in a window.
{{domxref("Window.focus()")}}
Sets focus on the current window.
{{domxref("Window.forward()")}} {{Non-standard_inline}} {{obsolete_inline}}
Moves the window one document forward in the history.
{{domxref("Window.getAttention()")}}
Flashes the application icon.
{{domxref("Window.getAttentionWithCycleCount()")}}
{{todo("NeedsContents")}}
{{domxref("Window.getComputedStyle()")}}
Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
{{domxref("Window.getDefaultComputedStyle()")}} {{Non-standard_inline}}
Gets default computed style for the specified element, ignoring author stylesheets.
{{domxref("Window.getSelection()")}}
Returns the selection object representing the selected item(s).
{{domxref("Window.home()")}} {{Non-standard_inline}} {{obsolete_inline}}
Returns the browser to the home page.
{{domxref("Window.matchMedia()")}} {{gecko_minversion_inline("6.0")}}
Returns a {{domxref("MediaQueryList")}} object representing the specified media query string.
{{domxref("Window.maximize()")}}
{{todo("NeedsContents")}}
{{domxref("Window.minimize()")}} (top-level XUL windows only)
Minimizes the window.
{{domxref("Window.moveBy()")}}
Moves the current window by a specified amount.
{{domxref("Window.moveTo()")}}
Moves the window to the specified coordinates.
{{domxref("Window.mozRequestAnimationFrame()")}} {{gecko_minversion_inline("2.0")}}
Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame. This will cause a MozBeforePaint event to fire before that repaint occurs.
{{domxref("Window.open()")}}
Opens a new window.
{{domxref("Window.openDialog()")}}
Opens a new dialog window.
{{domxref("Window.postMessage()")}} {{Fx_minversion_inline(3)}}
Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.
{{domxref("Window.print()")}}
Opens the Print Dialog to print the current document.
{{domxref("Window.prompt()")}}
Returns the text entered by the user in a prompt dialog.
{{domxref("Window.releaseEvents()")}} {{Deprecated_inline}}
Releases the window from trapping events of a specific type.
{{domxref("element.removeEventListener","Window.removeEventListener()")}}
Removes an event listener from the window.
{{domxref("Window.requestIdleCallback()")}}  {{experimental_inline}}
Enables the scheduling of tasks during a browser's idle periods.
{{domxref("Window.resizeBy()")}}
Resizes the current window by a certain amount.
{{domxref("Window.resizeTo()")}}
Dynamically resizes window.
{{domxref("Window.restore()")}}
{{todo("NeedsContents")}}
{{domxref("Window.routeEvent()")}} {{obsolete_inline(24)}}
{{todo("NeedsContents")}}
{{domxref("Window.scroll()")}}
Scrolls the window to a particular place in the document.
{{domxref("Window.scrollBy()")}}
Scrolls the document in the window by the given amount.
{{domxref("Window.scrollByLines()")}}
Scrolls the document by the given number of lines.
{{domxref("Window.scrollByPages()")}}
Scrolls the current document by the specified number of pages.
{{domxref("Window.scrollTo()")}}
Scrolls to a particular set of coordinates in the document.
{{domxref("Window.setCursor()")}}
Changes the cursor for the current window
{{domxref("Window.setImmediate()")}}
Executes a function after the browser has finished other heavy tasks
{{domxref("WindowTimers.setInterval()")}}
Schedules the execution of a function each X milliseconds.
{{domxref("Window.setResizable")}}
{{todo("NeedsContents")}}
{{domxref("WindowTimers.setTimeout()")}}
Sets a delay for executing a function.
{{domxref("Window.showModalDialog()")}} {{Fx_minversion_inline(3)}}
Displays a modal dialog.
{{domxref("Window.sizeToContent()")}}
Sizes the window according to its content.
{{domxref("Window.stop()")}}
This method stops window loading.
{{domxref("Window.updateCommands()")}}
Updates the state of commands of the current chrome window (UI).

Event handlers

These are properties of the window object that can be set to establish event handlers for the various things that can happen in the window that might be of interest.

This interface inherits event handlers from the {{domxref("EventTarget")}} interface and implements event handlers from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.

Note: Starting in {{Gecko("9.0")}}, you can now use the syntax if ("onabort" in window) to determine whether or not a given event handler property exists. This is because event handler interfaces have been updated to be proper web IDL interfaces. See DOM event handlers for details.

{{domxref("GlobalEventHandlers.onabort")}}
An event handler property for abort events on the window.
{{domxref("WindowEventHandlers.onafterprint")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("afterprint")}} event is raised.
{{domxref("WindowEventHandlers.onbeforeprint")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeprint")}} event is raised.
{{domxref("Window.onbeforeinstallprompt")}}
An event handler property dispatched before a user is prompted to save a web site to a home screen on mobile.
{{domxref("WindowEventHandlers.onbeforeunload")}}
An event handler property for before-unload events on the window.
{{domxref("GlobalEventHandlers.onblur")}}
An event handler property for blur events on the window.
{{domxref("GlobalEventHandlers.onchange")}}
An event handler property for change events on the window.
{{domxref("GlobalEventHandlers.onclick")}}
An event handler property for click events on the window.
{{domxref("GlobalEventHandlers.onclose")}}
An event handler property for handling the window close event.
{{domxref("GlobalEventHandlers.oncontextmenu")}}
An event handler property for right-click events on the window.
{{domxref("Window.ondevicelight")}}
An event handler property for any ambient light levels changes
{{domxref("Window.ondevicemotion")}} {{gecko_minversion_inline("6.0")}}
{{todo("NeedsContents")}}
{{domxref("Window.ondeviceorientation")}} {{gecko_minversion_inline("6.0")}}
An event handler property for any relative device orientation changes.
{{domxref("Window.ondeviceorientationabsolute")}} {{non-standard_inline}} Chrome only
An event handler property for any device orientation changes.
{{domxref("Window.ondeviceproximity")}}
An event handler property for device proximity event
{{domxref("GlobalEventHandlers.onerror")}}
An event handler property for {{event("error")}} events raised on the window.
{{domxref("GlobalEventHandlers.onfocus")}}
An event handler property for {{event("focus")}} events on the window.
{{domxref("WindowEventHandlers.onhashchange")}} {{gecko_minversion_inline("1.9.2")}}
An event handler property for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.
{{domxref("GlobalEventHandlers.onkeydown")}}
An event handler property for {{event("keydown")}} events on the window.
{{domxref("GlobalEventHandlers.onkeypress")}}
An event handler property for {{event("keypress")}} events on the window.
{{domxref("GlobalEventHandlers.onkeyup")}}
An event handler property for {{event("keyup")}} events on the window.
{{domxref("WindowEventHandlers.onlanguagechange")}}
An event handler property for {{event("languagechange")}} events on the window.
{{domxref("GlobalEventHandlers.onload")}}
An event handler property for window loading.
{{domxref("WindowEventHandlers.onmessage")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.
{{domxref("GlobalEventHandlers.onmousedown")}}
An event handler property for mousedown events on the window.
{{domxref("GlobalEventHandlers.onmousemove")}}
An event handler property for mousemove events on the window.
{{domxref("GlobalEventHandlers.onmouseout")}}
An event handler property for mouseout events on the window.
{{domxref("GlobalEventHandlers.onmouseover")}}
An event handler property for mouseover events on the window.
{{domxref("GlobalEventHandlers.onmouseup")}}
An event handler property for mouseup events on the window.
{{domxref("Window.onmozbeforepaint")}} {{gecko_minversion_inline("2.0")}}
An event handler property for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the {{domxref("Window.mozRequestAnimationFrame()")}} method.
{{domxref("WindowEventHandlers.onoffline")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("offline")}} event is raised.
{{domxref("WindowEventHandlers.ononline")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("online")}} event is raised.
{{domxref("WindowEventHandlers.onpagehide")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pagehide")}} event is raised.
{{domxref("WindowEventHandlers.onpageshow")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pageshow")}} event is raised.
{{domxref("Window.onpaint")}}
An event handler property for paint events on the window.
{{domxref("WindowEventHandlers.onpopstate")}} {{gecko_minversion_inline("2.0")}}
An event handler property for popstate events, which are dispatched when navigating to a session history entry representing a state object.
{{domxref("Window.onrejectionhandled")}} {{experimental_inline}}
An event handler for handled {{jsxref("Promise")}} rejection events.
{{domxref("GlobalEventHandlers.onreset")}}
An event handler property for reset events on the window.
{{domxref("GlobalEventHandlers.onresize")}}
An event handler property for window resizing.
{{domxref("GlobalEventHandlers.onscroll")}}
An event handler property for window scrolling.
{{domxref("GlobalEventHandlers.onselect")}}
An event handler property for window selection.
{{domxref("GlobalEventHandlers.onselectionchange")}}
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.
{{domxref("WindowEventHandlers.onstorage")}}
An event handler that runs when the {{event("storage")}} event fires. This occurs when a storage area is changed (e.g. a new item is stored.)
{{domxref("GlobalEventHandlers.onsubmit")}}
An event handler property for submits on window forms.
{{domxref("WindowEventHandlers.onunhandledrejection")}} {{experimental_inline}}
An event handler for unhandled {{jsxref("Promise")}} rejection events.
{{domxref("WindowEventHandlers.onunload")}}
An event handler property for unload events on the window.
{{domxref("Window.onuserproximity")}}
An event handler property for user proximity events

Constructors

See also the DOM Interfaces.

{{domxref("Window.DOMParser")}}
{{todo("NeedsContents")}}
{{domxref("Window.GeckoActiveXObject")}}
{{todo("NeedsContents")}}
{{domxref("Image")}}
Used for creating an {{domxref("HTMLImageElement")}}.
{{domxref("Option")}}
Used for creating an {{domxref("HTMLOptionElement")}}
{{domxref("Window.QueryInterface")}}
{{todo("NeedsContents")}}
{{domxref("Window.XMLSerializer")}}
{{todo("NeedsContents")}}
{{domxref("Worker")}}
Used for creating a Web worker
{{domxref("Window.XPCNativeWrapper")}}
{{todo("NeedsContents")}}
{{domxref("Window.XPCSafeJSObjectWrapper")}}
{{todo("NeedsContents")}}

Interfaces

See DOM Reference

See also

Revision Source

<p>{{APIRef}}</p>

<p><span class="seoSummary">The <code>window</code> object represents a window containing a DOM document; the <code>document</code> property points to the <a href="/en-US/docs/DOM/document">DOM document</a> loaded in that window.</span> A window for a given document can be obtained using the {{Domxref("document.defaultView")}} property.</p>

<p>This section provides a brief reference for all of the methods, properties, and events available through the DOM <code>window</code> object. The <code>window</code> object implements the <code>Window</code> interface, which in turn inherits from the <code><a href="https://www.w3.org/TR/DOM-Level-2-Views/views.html#Views-AbstractView">AbstractView</a></code> interface. Some additional global functions, namespaces, objects, interfaces, and constructors, not typically associated with the window, but available on it, are listed in the <a href="/en-US/docs/JavaScript/Reference">JavaScript Reference</a> and <a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">DOM Reference</a>.</p>

<p>In a tabbed browser, such as Firefox, each tab contains its own <code>window</code> object (and if you're writing an extension, the browser window itself is a separate window too - see <a href="/en-US/docs/Working_with_windows_in_chrome_code#Content_windows">Working with windows in chrome code</a> for more information). That is, the <code>window</code> object is not shared between tabs in the same window. Some methods, namely {{Domxref("window.resizeTo")}} and {{Domxref("window.resizeBy")}} apply to the whole window and not to the specific tab the <code>window</code> object belongs to. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.</p>

<h2 id="Properties">Properties</h2>

<p><em>This interface inherits properties from the {{domxref("EventTarget")}} interface and implements properties from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.</em></p>

<p>Note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below.</p>

<dl>
 <dt>{{domxref("Window.applicationCache")}}&nbsp; {{readOnlyInline}} {{gecko_minversion_inline("1.9")}}</dt>
 <dd>An {{domxref("OfflineResourceList")}} object providing access to the offline resources for the window.</dd>
 <dt>{{domxref("Window.caches")}} {{readOnlyInline}}</dt>
 <dd>Returns the {{domxref("CacheStorage")}} object associated with the current origin. This object enables <a href="/en-US/docs/Web/API/ServiceWorker_API">service worker</a> functionality such as storing assets for offline use, and generating custom responses to requests.</dd>
 <dt>{{domxref("Window.closed")}} {{Non-standard_inline}}{{readOnlyInline}}</dt>
 <dd>This property indicates whether the current window is closed or not.</dd>
 <dt><code><a href="/en-US/docs/Components_object">Window.Components</a></code> {{Non-standard_inline}}</dt>
 <dd>The entry point to many <a href="/en-US/docs/XPCOM">XPCOM</a> features. Some properties, e.g. <a href="/en-US/docs/Components.classes">classes</a>, are only available to sufficiently privileged code. <strong>Web code should not use this property.</strong></dd>
 <dt>{{domxref("console","Window.console")}} {{Non-standard_inline}} {{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the console object providing access to the browser's debugging console.</dd>
 <dt>{{domxref("Window.content")}} and Window._content {{Non-standard_inline}} {{obsolete_inline}}{{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the content element in the current window. The obsolete variant with underscore is no longer available from Web content.</dd>
 <dt>{{domxref("Window.controllers")}}{{non-standard_inline}}{{ReadOnlyInline}}</dt>
 <dd>Returns the XUL controller objects for the current chrome window.</dd>
 <dt>{{domxref("Window.crypto")}} {{readOnlyInline}}</dt>
 <dd>Returns the browser crypto object.</dd>
 <dt>{{domxref("Window.defaultStatus")}} {{Obsolete_inline("gecko23")}}</dt>
 <dd>Gets/sets the status bar text for the given window.</dd>
 <dt>{{domxref("Window.devicePixelRatio")}} {{non-standard_inline}}{{ReadOnlyInline}}</dt>
 <dd>Returns the ratio between physical pixels and device independent pixels in the current display.</dd>
 <dt>{{domxref("Window.dialogArguments")}} {{Fx_minversion_inline(3)}} {{ReadOnlyInline}}</dt>
 <dd>Gets the arguments passed to the window (if it's a dialog box) at the time {{domxref("window.showModalDialog()")}} was called. This is an {{Interface("nsIArray")}}.</dd>
 <dt>{{domxref("Window.directories")}} {{obsolete_inline}}</dt>
 <dd>Synonym of {{domxref("window.personalbar")}}</dd>
 <dt>{{domxref("Window.document")}} {{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the document that the window contains.</dd>
 <dt>{{domxref("Window.frameElement")}} {{readOnlyInline}}</dt>
 <dd>Returns the element in which the window is embedded, or null if the window is not embedded.</dd>
 <dt>{{domxref("Window.frames")}} {{readOnlyInline}}</dt>
 <dd>Returns an array of the subframes in the current window.</dd>
 <dt>{{domxref("Window.fullScreen")}} {{gecko_minversion_inline("1.9")}}</dt>
 <dd>This property indicates whether the window is displayed in full screen or not.</dd>
 <dt>{{domxref("Window.globalStorage")}} {{gecko_minversion_inline("1.8.1")}} {{Non-standard_inline}} {{Obsolete_inline("gecko13")}}</dt>
 <dd>Unsupported since Gecko 13 (Firefox 13). Use {{domxref("Window.localStorage")}} instead.<br />
 Was: Multiple storage objects that are used for storing data across multiple pages.</dd>
 <dt>{{domxref("Window.history")}} {{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the history object.</dd>
 <dt>{{domxref("Window.innerHeight")}}</dt>
 <dd>Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.</dd>
 <dt>{{domxref("Window.innerWidth")}}</dt>
 <dd>Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.</dd>
 <dt>{{domxref("Window.isSecureContext")}}&nbsp;{{readOnlyInline}}</dt>
 <dd>Indicates whether a context is capable of using features that require secure contexts.</dd>
 <dt>{{domxref("Window.length")}} {{readOnlyInline}}</dt>
 <dd>Returns the number of frames in the window. See also {{domxref("window.frames")}}.</dd>
 <dt>{{domxref("Window.location")}} {{ReadOnlyInline}}</dt>
 <dd>Gets/sets the location, or current URL, of the window object.</dd>
 <dt>{{domxref("Window.locationbar")}} {{ReadOnlyInline}}</dt>
 <dd>Returns the locationbar object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.localStorage")}} {{readOnlyInline}}{{gecko_minversion_inline("1.9.1")}}</dt>
 <dd>Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.</dd>
 <dt>{{domxref("Window.menubar")}} {{ReadOnlyInline}}</dt>
 <dd>Returns the menubar object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.messageManager")}} {{gecko_minversion_inline("2.0")}}</dt>
 <dd>Returns the <a href="/en-US/docs/The_message_manager">message manager</a> object for this window.</dd>
 <dt>{{domxref("Window.mozAnimationStartTime")}} {{ReadOnlyInline}}{{gecko_minversion_inline("2.0")}}</dt>
 <dd>The time in milliseconds since epoch at which the current animation cycle began.</dd>
 <dt>{{domxref("Window.mozInnerScreenX")}} {{ReadOnlyInline}}{{non-standard_inline}}{{gecko_minversion_inline("1.9.2")}}</dt>
 <dd>Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See <code>mozScreenPixelsPerCSSPixel</code> in {{interface("nsIDOMWindowUtils")}} for a conversion factor to adapt to screen pixels if needed.</dd>
 <dt>{{domxref("Window.mozInnerScreenY")}} {{ReadOnlyInline}} {{non-standard_inline}}{{gecko_minversion_inline("1.9.2")}}</dt>
 <dd>Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See <code>mozScreenPixelsPerCSSPixel</code> for a conversion factor to adapt to screen pixels if needed.</dd>
 <dt>{{domxref("Window.mozPaintCount")}} {{non-standard_inline}}{{ReadOnlyInline}} {{gecko_minversion_inline("2.0")}}</dt>
 <dd>Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.</dd>
 <dt>{{domxref("Window.name")}}</dt>
 <dd>Gets/sets the name of the window.</dd>
 <dt>{{domxref("Window.navigator")}} {{readOnlyInline}}</dt>
 <dd>Returns a reference to the navigator object.</dd>
 <dt>{{domxref("Window.opener")}}</dt>
 <dd>Returns a reference to the window that opened this current window.</dd>
 <dt>{{domxref("Window.orientation")}}{{non-standard_inline}}{{deprecated_inline}}{{readOnlyInline}}</dt>
 <dd>Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.</dd>
 <dt>{{domxref("Window.outerHeight")}} {{readOnlyInline}}</dt>
 <dd>Gets the height of the outside of the browser window.</dd>
 <dt>{{domxref("Window.outerWidth")}} {{readOnlyInline}}</dt>
 <dd>Gets the width of the outside of the browser window.</dd>
 <dt>{{domxref("Window.scrollX","Window.pageXOffset")}} {{readOnlyInline}}</dt>
 <dd>An alias for {{domxref("window.scrollX")}}.</dd>
 <dt>{{domxref("Window.scrollY","Window.pageYOffset")}}{{readOnlyInline}}</dt>
 <dd>An alias for {{domxref("window.scrollY")}}</dd>
 <dt>{{domxref("Window.sessionStorage")}} {{readOnlyInline}}</dt>
 <dd>Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.</dd>
 <dt>{{domxref("Window.parent")}} {{readOnlyInline}}</dt>
 <dd>Returns a reference to the parent of the current window or subframe.</dd>
 <dt>{{domxref("Window.performance")}} {{readOnlyInline}}</dt>
 <dd>Provides a hosting area for <a href="/en-US/docs/Navigation_timing">performance related</a> attributes.</dd>
 <dt>{{domxref("Window.personalbar")}} {{readOnlyInline}}</dt>
 <dd>Returns the personalbar object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.pkcs11")}} {{obsolete_inline(29)}}</dt>
 <dd>Formerly provided access to install and remove PKCS11 modules.</dd>
 <dt>{{domxref("Window.returnValue")}} {{Fx_minversion_inline(3)}}</dt>
 <dd>The return value to be returned to the function that called {{domxref("window.showModalDialog()")}} to display the window as a modal dialog.</dd>
 <dt>{{domxref("Window.screen")}} {{readOnlyInline}}</dt>
 <dd>Returns a reference to the screen object associated with the window.</dd>
 <!-- The following is duplicated on DOM:window.screen -->
 <dt>{{domxref("Window.screenX")}} {{readOnlyInline}}</dt>
 <dd>Returns the horizontal distance of the left border of the user's browser from the left side of the screen.</dd>
 <dt>{{domxref("Window.screenY")}} {{readOnlyInline}}</dt>
 <dd>Returns the vertical distance of the top border of the user's browser from the top side of the screen.</dd>
 <dt>{{domxref("Window.scrollbars")}} {{readOnlyInline}}</dt>
 <dd>Returns the scrollbars object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.scrollMaxX")}}{{non-standard_inline}}{{ReadOnlyInline}}</dt>
 <dd>The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.</dd>
 <dt>{{domxref("Window.scrollMaxY")}}{{non-standard_inline}}{{ReadOnlyInline}}</dt>
 <dd>The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).</dd>
 <dt>{{domxref("Window.scrollX")}} {{readOnlyInline}}</dt>
 <dd>Returns the number of pixels that the document has already been scrolled horizontally.</dd>
 <dt>{{domxref("Window.scrollY")}} {{readOnlyInline}}</dt>
 <dd>Returns the number of pixels that the document has already been scrolled vertically.</dd>
 <dt>{{domxref("Window.self")}} {{ReadOnlyInline}}</dt>
 <dd>Returns an object reference to the window object itself.</dd>
 <dt>{{domxref("Window.sessionStorage")}} {{Fx_minversion_inline("2.0")}}</dt>
 <dd>Returns a storage object for storing data within a single page session.</dd>
 <dt>{{domxref("Window.sidebar")}} {{non-standard_inline}}{{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the window object of the sidebar.</dd>
 <dt>{{domxref("Window.speechSynthesis")}} {{ReadOnlyInline}}</dt>
 <dd>Returns a {{domxref("SpeechSynthesis")}} object, which is the entry point into using <a href="/en-US/docs/Web/API/Web_Speech_API">Web Speech API</a> speech synthesis functionality.</dd>
 <dt>{{domxref("Window.status")}}</dt>
 <dd>Gets/sets the text in the statusbar at the bottom of the browser.</dd>
 <dt>{{domxref("Window.statusbar")}} {{readOnlyInline}}</dt>
 <dd>Returns the statusbar object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.toolbar")}} {{readOnlyInline}}</dt>
 <dd>Returns the toolbar object, whose visibility can be toggled in the window.</dd>
 <dt>{{domxref("Window.top")}} {{readOnlyInline}}</dt>
 <dd>Returns a reference to the topmost window in the window hierarchy. This property is read only.</dd>
 <dt>{{domxref("Window.window")}} {{ReadOnlyInline}}</dt>
 <dd>Returns a reference to the current window.</dd>
 <dt><code>window[0]</code>,<code> window[1]</code>, etc.</dt>
 <dd>Returns a reference to the <code>window</code> object in the frames. See {{domxref("Window.frames")}} for more details.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>This interface inherits methods from the {{domxref("EventTarget")}} interface and implements methods from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, {{domxref("WindowEventHandlers")}}, and {{domxref("GlobalFetch")}}.</em></p>

<dl>
 <dt>{{domxref("EventTarget.addEventListener()")}}</dt>
 <dd>Register an event handler to a specific event type on the window.</dd>
 <dt>{{domxref("Window.alert()")}}</dt>
 <dd>Displays an alert dialog.</dd>
 <!-- base64 func <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=287112" rel="freelink">https://bugzilla.mozilla.org/show_bug.cgi?id=287112</a> (see last comments) <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=123003" rel="freelink">https://bugzilla.mozilla.org/show_bug.cgi?id=123003</a> <a href="https://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#4946" rel="freelink">https://lxr.mozilla.org/seamonkey/sou...indow.cpp#4946</a> -->
 <dt>{{domxref("WindowBase64.atob()")}}</dt>
 <dd>Decodes a string of data which has been encoded using base-64 encoding.</dd>
 <dt>{{domxref("Window.back()")}} {{Non-standard_inline}} {{obsolete_inline}}</dt>
 <dd>Moves back one in the window history.</dd>
 <dt>{{domxref("Window.blur()")}}</dt>
 <dd>Sets focus away from the window.</dd>
 <dt>{{domxref("WindowBase64.btoa()")}}</dt>
 <dd>Creates a base-64 encoded ASCII string from a string of binary data.</dd>
 <dt>{{domxref("Window.cancelIdleCallback()")}}&nbsp;{{experimental_inline}}</dt>
 <dd>Enables you to cancel a callback previously scheduled with {{domxref("Window.requestIdleCallback")}}.</dd>
 <dt>{{domxref("Window.captureEvents()")}} {{Deprecated_inline}}</dt>
 <dd>Registers the window to capture all events of the specified type.</dd>
 <dt>{{domxref("Window.clearImmediate()")}}</dt>
 <dd>Cancels the repeated execution set using <code>setImmediate</code>.</dd>
 <dt>{{domxref("WindowTimers.clearInterval()")}}</dt>
 <dd>Cancels the repeated execution set using {{domxref("WindowTimers.setInterval()")}}.</dd>
 <dt>{{domxref("WindowTimers.clearTimeout()")}}</dt>
 <dd>Cancels the repeated execution set using {{domxref("WindowTimers.setTimeout()")}}.</dd>
 <dt>{{domxref("Window.close()")}}</dt>
 <dd>Closes the current window.</dd>
 <dt>{{domxref("Window.confirm()")}}</dt>
 <dd>Displays a dialog with a message that the user needs to respond to.</dd>
 <dt>{{domxref("Window.disableExternalCapture()")}} {{obsolete_inline(24)}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.dispatchEvent()")}}</dt>
 <dd>Used to trigger an event.</dd>
 <dt>{{domxref("Window.dump()")}}</dt>
 <dd>Writes a message to the console.</dd>
 <dt>{{domxref("Window.enableExternalCapture()")}} {{obsolete_inline(24)}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("GlobalFetch.fetch()")}}</dt>
 <dd>Starts the process of fetching a resource.</dd>
 <dt>{{domxref("Window.find()")}}</dt>
 <dd>Searches for a given string in a window.</dd>
 <dt>{{domxref("Window.focus()")}}</dt>
 <dd>Sets focus on the current window.</dd>
 <dt>{{domxref("Window.forward()")}} {{Non-standard_inline}} {{obsolete_inline}}</dt>
 <dd>Moves the window one document forward in the history.</dd>
 <dt>{{domxref("Window.getAttention()")}}</dt>
 <dd>Flashes the application icon.</dd>
 <dt>{{domxref("Window.getAttentionWithCycleCount()")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.getComputedStyle()")}}</dt>
 <dd>Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.</dd>
 <dt>{{domxref("Window.getDefaultComputedStyle()")}}&nbsp;{{Non-standard_inline}}</dt>
 <dd>Gets default computed style for the specified element, ignoring author stylesheets.</dd>
 <dt>{{domxref("Window.getSelection()")}}</dt>
 <dd>Returns the selection object representing the selected item(s).</dd>
 <dt>{{domxref("Window.home()")}} {{Non-standard_inline}} {{obsolete_inline}}</dt>
 <dd>Returns the browser to the home page.</dd>
 <dt>{{domxref("Window.matchMedia()")}} {{gecko_minversion_inline("6.0")}}</dt>
 <dd>Returns a {{domxref("MediaQueryList")}} object representing the specified media query string.</dd>
 <dt>{{domxref("Window.maximize()")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.minimize()")}} (top-level XUL windows only)</dt>
 <dd>Minimizes the window.</dd>
 <dt>{{domxref("Window.moveBy()")}}</dt>
 <dd>Moves the current window by a specified amount.</dd>
 <dt>{{domxref("Window.moveTo()")}}</dt>
 <dd>Moves the window to the specified coordinates.</dd>
 <dt>{{domxref("Window.mozRequestAnimationFrame()")}} {{gecko_minversion_inline("2.0")}}</dt>
 <dd>Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame. This will cause a <code>MozBeforePaint</code> event to fire before that repaint occurs.</dd>
 <dt>{{domxref("Window.open()")}}</dt>
 <dd>Opens a new window.</dd>
 <dt>{{domxref("Window.openDialog()")}}</dt>
 <dd>Opens a new dialog window.</dd>
 <dt>{{domxref("Window.postMessage()")}} {{Fx_minversion_inline(3)}}</dt>
 <dd>Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.</dd>
 <dt>{{domxref("Window.print()")}}</dt>
 <dd>Opens the Print Dialog to print the current document.</dd>
 <dt>{{domxref("Window.prompt()")}}</dt>
 <dd>Returns the text entered by the user in a prompt dialog.</dd>
 <dt>{{domxref("Window.releaseEvents()")}} {{Deprecated_inline}}</dt>
 <dd>Releases the window from trapping events of a specific type.</dd>
 <dt>{{domxref("element.removeEventListener","Window.removeEventListener()")}}</dt>
 <dd>Removes an event listener from the window.</dd>
 <dt>{{domxref("Window.requestIdleCallback()")}} &nbsp;{{experimental_inline}}</dt>
 <dd>Enables the scheduling of tasks during a browser's idle periods.</dd>
 <dt>{{domxref("Window.resizeBy()")}}</dt>
 <dd>Resizes the current window by a certain amount.</dd>
 <dt>{{domxref("Window.resizeTo()")}}</dt>
 <dd>Dynamically resizes window.</dd>
 <dt>{{domxref("Window.restore()")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.routeEvent()")}} {{obsolete_inline(24)}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.scroll()")}}</dt>
 <dd>Scrolls the window to a particular place in the document.</dd>
 <dt>{{domxref("Window.scrollBy()")}}</dt>
 <dd>Scrolls the document in the window by the given amount.</dd>
 <dt>{{domxref("Window.scrollByLines()")}}</dt>
 <dd>Scrolls the document by the given number of lines.</dd>
 <dt>{{domxref("Window.scrollByPages()")}}</dt>
 <dd>Scrolls the current document by the specified number of pages.</dd>
 <dt>{{domxref("Window.scrollTo()")}}</dt>
 <dd>Scrolls to a particular set of coordinates in the document.</dd>
 <dt>{{domxref("Window.setCursor()")}}</dt>
 <dd>Changes the cursor for the current window</dd>
 <dt>{{domxref("Window.setImmediate()")}}</dt>
 <dd>Executes a function after the browser has finished other heavy tasks</dd>
 <dt>{{domxref("WindowTimers.setInterval()")}}</dt>
 <dd>Schedules the execution of a function each X milliseconds.</dd>
 <dt>{{domxref("Window.setResizable")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("WindowTimers.setTimeout()")}}</dt>
 <dd>Sets a delay for executing a function.</dd>
 <dt>{{domxref("Window.showModalDialog()")}} {{Fx_minversion_inline(3)}}</dt>
 <dd>Displays a modal dialog.</dd>
 <dt>{{domxref("Window.sizeToContent()")}}</dt>
 <dd>Sizes the window according to its content.</dd>
 <dt>{{domxref("Window.stop()")}}</dt>
 <dd>This method stops window loading.</dd>
 <dt>{{domxref("Window.updateCommands()")}}</dt>
 <dd>Updates the state of commands of the current chrome window (UI).</dd>
</dl>

<h2 id="Event_handlers">Event handlers</h2>

<p>These are properties of the window object that can be set to establish event handlers for the various things that can happen in the window that might be of interest.</p>

<p><em>This interface inherits event handlers from the {{domxref("EventTarget")}} interface and implements event handlers from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.</em></p>

<div class="note">
<p><strong>Note:</strong> Starting in {{Gecko("9.0")}}, you can now use the syntax <code>if ("onabort" in window)</code> to determine whether or not a given event handler property exists. This is because event handler interfaces have been updated to be proper web IDL interfaces. See <a href="/en-US/docs/DOM/DOM_event_handlers">DOM event handlers</a> for details.</p>
</div>

<dl>
 <dt>{{domxref("GlobalEventHandlers.onabort")}}</dt>
 <dd>An event handler property for abort events on the window.</dd>
 <dt>{{domxref("WindowEventHandlers.onafterprint")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("afterprint")}} event is raised.</dd>
 <dt>{{domxref("WindowEventHandlers.onbeforeprint")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeprint")}} event is raised.</dd>
 <dt>{{domxref("Window.onbeforeinstallprompt")}}</dt>
 <dd>An event handler property dispatched before a&nbsp;user is prompted to save a web site to a home screen on mobile.</dd>
 <dt>{{domxref("WindowEventHandlers.onbeforeunload")}}</dt>
 <dd>An event handler property for before-unload events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onblur")}}</dt>
 <dd>An event handler property for blur events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onchange")}}</dt>
 <dd>An event handler property for change events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onclick")}}</dt>
 <dd>An event handler property for click events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onclose")}}</dt>
 <dd>An event handler property for handling the window close event.</dd>
 <dt>{{domxref("GlobalEventHandlers.oncontextmenu")}}</dt>
 <dd>An event handler property for right-click events on the window.</dd>
 <dt>{{domxref("Window.ondevicelight")}}</dt>
 <dd>An event handler property for any ambient light levels changes</dd>
 <dt>{{domxref("Window.ondevicemotion")}} {{gecko_minversion_inline("6.0")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.ondeviceorientation")}} {{gecko_minversion_inline("6.0")}}</dt>
 <dd>An event handler property for any relative device orientation changes.</dd>
 <dt>{{domxref("Window.ondeviceorientationabsolute")}}&nbsp;{{non-standard_inline}} Chrome only</dt>
 <dd>An event handler property for any device orientation changes.</dd>
 <dt>{{domxref("Window.ondeviceproximity")}}</dt>
 <dd>An event handler property for device proximity event</dd>
 <dt>{{domxref("GlobalEventHandlers.onerror")}}</dt>
 <dd>An event handler property for {{event("error")}} events raised on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onfocus")}}</dt>
 <dd>An event handler property for {{event("focus")}} events on the window.</dd>
 <dt>{{domxref("WindowEventHandlers.onhashchange")}} {{gecko_minversion_inline("1.9.2")}}</dt>
 <dd>An event handler property for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.</dd>
 <dt>{{domxref("GlobalEventHandlers.onkeydown")}}</dt>
 <dd>An event handler property for {{event("keydown")}} events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onkeypress")}}</dt>
 <dd>An event handler property for {{event("keypress")}} events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onkeyup")}}</dt>
 <dd>An event handler property for {{event("keyup")}} events on the window.</dd>
 <dt>{{domxref("WindowEventHandlers.onlanguagechange")}}</dt>
 <dd>An event handler property for {{event("languagechange")}} events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onload")}}</dt>
 <dd>An event handler property for window loading.</dd>
 <dt>{{domxref("WindowEventHandlers.onmessage")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.</dd>
 <dt>{{domxref("GlobalEventHandlers.onmousedown")}}</dt>
 <dd>An event handler property for mousedown events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onmousemove")}}</dt>
 <dd>An event handler property for mousemove events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onmouseout")}}</dt>
 <dd>An event handler property for mouseout events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onmouseover")}}</dt>
 <dd>An event handler property for mouseover events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onmouseup")}}</dt>
 <dd>An event handler property for mouseup events on the window.</dd>
 <dt>{{domxref("Window.onmozbeforepaint")}} {{gecko_minversion_inline("2.0")}}</dt>
 <dd>An event handler property for the <code>MozBeforePaint</code> event, which is sent before repainting the window if the event has been requested by a call to the {{domxref("Window.mozRequestAnimationFrame()")}} method.</dd>
 <dt>{{domxref("WindowEventHandlers.onoffline")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("offline")}} event is raised.</dd>
 <dt>{{domxref("WindowEventHandlers.ononline")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("online")}} event is raised.</dd>
 <dt>{{domxref("WindowEventHandlers.onpagehide")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pagehide")}} event is raised.</dd>
 <dt>{{domxref("WindowEventHandlers.onpageshow")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pageshow")}} event is raised.</dd>
 <dt>{{domxref("Window.onpaint")}}</dt>
 <dd>An event handler property for paint events on the window.</dd>
 <dt>{{domxref("WindowEventHandlers.onpopstate")}} {{gecko_minversion_inline("2.0")}}</dt>
 <dd>An event handler property for popstate events, which are dispatched when navigating to a session history entry representing a state object.</dd>
 <dt>{{domxref("Window.onrejectionhandled")}} {{experimental_inline}}</dt>
 <dd>An event handler for handled {{jsxref("Promise")}} rejection events.</dd>
 <dt>{{domxref("GlobalEventHandlers.onreset")}}</dt>
 <dd>An event handler property for reset events on the window.</dd>
 <dt>{{domxref("GlobalEventHandlers.onresize")}}</dt>
 <dd>An event handler property for window resizing.</dd>
 <dt>{{domxref("GlobalEventHandlers.onscroll")}}</dt>
 <dd>An event handler property for window scrolling.</dd>
 <dt>{{domxref("GlobalEventHandlers.onselect")}}</dt>
 <dd>An event handler property for window selection.</dd>
 <dt>{{domxref("GlobalEventHandlers.onselectionchange")}}</dt>
 <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.</dd>
 <dt>{{domxref("WindowEventHandlers.onstorage")}}</dt>
 <dd>An event handler that runs when&nbsp;the {{event("storage")}} event fires. This occurs when a storage area is changed (e.g. a new item is stored.)</dd>
 <dt>{{domxref("GlobalEventHandlers.onsubmit")}}</dt>
 <dd>An event handler property for submits on window forms.</dd>
 <dt>{{domxref("WindowEventHandlers.onunhandledrejection")}} {{experimental_inline}}</dt>
 <dd>An event handler for unhandled {{jsxref("Promise")}} rejection events.</dd>
 <dt>{{domxref("WindowEventHandlers.onunload")}}</dt>
 <dd>An event handler property for unload events on the window.</dd>
 <dt>{{domxref("Window.onuserproximity")}}</dt>
 <dd>An event handler property for user proximity events</dd>
</dl>

<h2 id="Constructors">Constructors</h2>

<p>See also the <a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">DOM Interfaces</a>.</p>

<dl>
 <dt>{{domxref("Window.DOMParser")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.GeckoActiveXObject")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Image")}}</dt>
 <dd>Used for creating an {{domxref("HTMLImageElement")}}.</dd>
 <dt>{{domxref("Option")}}</dt>
 <dd>Used for creating an {{domxref("HTMLOptionElement")}}</dd>
 <dt>{{domxref("Window.QueryInterface")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.XMLSerializer")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Worker")}}</dt>
 <dd>Used for creating a <a href="/en-US/docs/DOM/Using_web_workers">Web worker</a></dd>
 <dt>{{domxref("Window.XPCNativeWrapper")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
 <dt>{{domxref("Window.XPCSafeJSObjectWrapper")}}</dt>
 <dd>{{todo("NeedsContents")}}</dd>
</dl>

<h2 id="Interfaces">Interfaces</h2>

<p>See <a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">DOM Reference</a></p>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Working_with_windows_in_chrome_code">Working with windows in chrome code</a></li>
</ul>
Revert to this revision