W3cubDocs

/DOM

Window

The Window interface 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 document.defaultView property.

A global variable, window, representing the window in which the script is running, is exposed to JavaScript code.

The Window interface is home to a variety of functions, namespaces, objects, and constructors which are not necessarily directly associated with the concept of a user interface window. However, the Window interface is a suitable place to include these items that need to be globally available. Many of these are documented in the JavaScript Reference and the DOM Reference.

In a tabbed browser, each tab is represented by its own Window object; the global window seen by JavaScript code running within a given tab always represents the tab in which the code is running. That said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeTo() and innerHeight. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.

Properties

This interface inherits properties from the EventTarget interface and implements properties from the WindowOrWorkerGlobalScope and WindowEventHandlers mixins.

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

Window.closed Read only
This property indicates whether the current window is closed or not.
Window.console Read only
Returns a reference to the console object which provides access to the browser's debugging console.
Window.content and Window._content Read only
Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.
Window.controllers Read only
Returns the XUL controller objects for the current chrome window.
Window.customElements Read only
returns a reference to the CustomElementRegistry object, which can be used to register new custom elements and get information about previously registered custom elements.
Window.crypto Read only
Returns the browser crypto object.
Window.defaultStatus Obsolete since Gecko 23
Gets/sets the status bar text for the given window.
Window.devicePixelRatio Read only
Returns the ratio between physical pixels and device independent pixels in the current display.
Window.dialogArguments Read only
Gets the arguments passed to the window (if it's a dialog box) at the time window.showModalDialog() was called. This is an nsIArray.
Window.directories
Synonym of window.personalbar
Window.document Read only
Returns a reference to the document that the window contains.
Window.DOMMatrix Read only
Returns a reference to a DOMMatrix object, which represents 4x4 matrices, suitable for 2D and 3D operations.
Window.DOMMatrixReadOnly Read only
Returns a reference to a DOMMatrixReadOnly object, which represents 4x4 matrices, suitable for 2D and 3D operations.
Window.DOMPoint Read only
Returns a reference to a DOMPoint object, which represents a 2D or 3D point in a coordinate system.
Window.DOMPointReadOnly Read only
Returns a reference to a DOMPointReadOnly object, which represents a 2D or 3D point in a coordinate system.
Window.DOMQuad Read only
Returns a reference to a DOMQuad object, which provides represents a quadrilaterial object, that is one having four corners and four sides.
Window.DOMRect Read only
Returns a reference to a DOMRect object, which represents a rectangle.
Window.DOMRectReadOnly Read only
Returns a reference to a DOMRectReadOnly object, which represents a rectangle.
Window.event Read only
Returns the current event, which is the event currently being handled by the JavaScript code's context, or undefined if no event is currently being handled. The Event object passed directly to event handlers should be used instead whenever possible.
Window.frameElement Read only
Returns the element in which the window is embedded, or null if the window is not embedded.
Window.frames Read only
Returns an array of the subframes in the current window.
Window.fullScreen
This property indicates whether the window is displayed in full screen or not.
Window.globalStorage Obsolete since Gecko 13
Unsupported since Gecko 13 (Firefox 13). Use Window.localStorage instead.
Was: Multiple storage objects that are used for storing data across multiple pages.
Window.history Read only
Returns a reference to the history object.
Window.innerHeight Read only
Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
Window.innerWidth Read only
Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
Window.isSecureContext Read only
Indicates whether a context is capable of using features that require secure contexts.
Window.length Read only
Returns the number of frames in the window. See also window.frames.
Window.location
Gets/sets the location, or current URL, of the window object.
Window.locationbar Read only
Returns the locationbar object, whose visibility can be toggled in the window.
Window.localStorage Read only
Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
Window.menubar Read only
Returns the menubar object, whose visibility can be toggled in the window.
Window.messageManager
Returns the message manager object for this window.
Window.mozAnimationStartTime Read only
The time in milliseconds since epoch at which the current animation cycle began. Use Animation.startTime instead.
Window.mozInnerScreenX Read only
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 nsIDOMWindowUtils for a conversion factor to adapt to screen pixels if needed.
Window.mozInnerScreenY Read only
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.
Window.mozPaintCount Read only
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.
Window.name
Gets/sets the name of the window.
Window.navigator Read only
Returns a reference to the navigator object.
Window.opener
Returns a reference to the window that opened this current window.
Window.orientation Read only
Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
Window.outerHeight Read only
Gets the height of the outside of the browser window.
Window.outerWidth Read only
Gets the width of the outside of the browser window.
Window.pageXOffset Read only
An alias for window.scrollX.
Window.pageYOffset Read only
An alias for window.scrollY
Window.parent Read only
Returns a reference to the parent of the current window or subframe.
Window.performance Read only
Returns a Performance object, which includes the timing and navigation attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.
Window.personalbar Read only
Returns the personalbar object, whose visibility can be toggled in the window.
Window.pkcs11 Obsolete since Gecko 29
Formerly provided access to install and remove PKCS11 modules.
Window.returnValue
The return value to be returned to the function that called window.showModalDialog() to display the window as a modal dialog.
Window.screen Read only
Returns a reference to the screen object associated with the window.
Window.screenX and Window.screenLeft Read only
Both properties return the horizontal distance from the left border of the user's browser viewport to the left side of the screen.
Window.screenY and Window.screenTop Read only
Both properties return the vertical distance from the top border of the user's browser viewport to the top side of the screen.
Window.scrollbars Read only
Returns the scrollbars object, whose visibility can be toggled in the window.
Window.scrollMaxX Read only
The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
Window.scrollMaxY Read only
The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
Window.scrollX Read only
Returns the number of pixels that the document has already been scrolled horizontally.
Window.scrollY Read only
Returns the number of pixels that the document has already been scrolled vertically.
Window.self Read only
Returns an object reference to the window object itself.
Window.sessionStorage
Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
Window.sidebar Read only
Returns a reference to the window object of the sidebar.
Window.speechSynthesis Read only
Returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality.
Window.status
Gets/sets the text in the statusbar at the bottom of the browser.
Window.statusbar Read only
Returns the statusbar object, whose visibility can be toggled in the window.
Window.toolbar Read only
Returns the toolbar object, whose visibility can be toggled in the window.
Window.top Read only
Returns a reference to the topmost window in the window hierarchy. This property is read only.
Window.visualViewport Read only
Returns a VisualViewport object which represents the visual viewport for a given window.
Window.window Read only
Returns a reference to the current window.
window[0], window[1], etc.
Returns a reference to the window object in the frames. See Window.frames for more details.

Properties implemented from elsewhere

WindowOrWorkerGlobalScope.caches Read only
Returns the CacheStorage object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests.
WindowOrWorkerGlobalScope.indexedDB Read only
Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an IDBFactory object.
WindowOrWorkerGlobalScope.isSecureContext Read only
Returns a boolean indicating whether the current context is secure (true) or not (false).
WindowOrWorkerGlobalScope.origin Read only
Returns the global object's origin, serialized as a string. (This does not yet appear to be implemented in any browser.)

Methods

This interface inherits methods from the EventTarget interface and implements methods from WindowOrWorkerGlobalScope and EventTarget.

Window.alert()
Displays an alert dialog.
Window.back()
Moves back one in the window history. This method is obsolete; you should instead use window.history.back().
Window.blur()
Sets focus away from the window.
Window.cancelAnimationFrame()
Enables you to cancel a callback previously scheduled with Window.requestAnimationFrame.
Window.cancelIdleCallback()
Enables you to cancel a callback previously scheduled with Window.requestIdleCallback.
Window.captureEvents()
Registers the window to capture all events of the specified type.
Window.clearImmediate()
Cancels the repeated execution set using setImmediate.
Window.close()
Closes the current window.
Window.confirm()
Displays a dialog with a message that the user needs to respond to.
Window.disableExternalCapture() Obsolete since Gecko 24
Window.dispatchEvent()
Used to trigger an event.
Window.dump()
Writes a message to the console.
Window.enableExternalCapture() Obsolete since Gecko 24
Window.find()
Searches for a given string in a window.
Window.focus()
Sets focus on the current window.
Window.forward()
Moves the window one document forward in the history. This method is obsolete; you should instead use window.history.forward().
Window.getAttention()
Flashes the application icon.
Window.getAttentionWithCycleCount()
Window.getComputedStyle()
Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
Window.getDefaultComputedStyle()
Gets default computed style for the specified element, ignoring author stylesheets.
Window.getSelection()
Returns the selection object representing the selected item(s).
Window.home()
Returns the browser to the home page.
Window.matchMedia()
Returns a MediaQueryList object representing the specified media query string.
Window.maximize()
Window.minimize() (top-level XUL windows only)
Minimizes the window.
Window.moveBy()
Moves the current window by a specified amount.
Window.moveTo()
Moves the window to the specified coordinates.
Window.open()
Opens a new window.
Window.openDialog()
Opens a new dialog window.
Window.postMessage()
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.
Window.print()
Opens the Print Dialog to print the current document.
Window.prompt()
Returns the text entered by the user in a prompt dialog.
Window.releaseEvents()
Releases the window from trapping events of a specific type.
Window.requestAnimationFrame()
Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.
Window.requestIdleCallback()
Enables the scheduling of tasks during a browser's idle periods.
Window.resizeBy()
Resizes the current window by a certain amount.
Window.resizeTo()
Dynamically resizes window.
Window.restore()
Window.routeEvent() Obsolete since Gecko 24
Window.scroll()
Scrolls the window to a particular place in the document.
Window.scrollBy()
Scrolls the document in the window by the given amount.
Window.scrollByLines()
Scrolls the document by the given number of lines.
Window.scrollByPages()
Scrolls the current document by the specified number of pages.
Window.scrollTo()
Scrolls to a particular set of coordinates in the document.
Window.setCursor() (top-level XUL windows only)
Changes the cursor for the current window
Window.setImmediate()
Executes a function after the browser has finished other heavy tasks
Window.setResizable()
Toggles a user's ability to resize a window.
Window.sizeToContent()
Sizes the window according to its content.
Window.stop()
This method stops window loading.
Window.updateCommands()
Updates the state of commands of the current chrome window (UI).

Methods implemented from elsewhere

EventTarget.addEventListener()
Register an event handler to a specific event type on the window.
WindowOrWorkerGlobalScope.atob()
Decodes a string of data which has been encoded using base-64 encoding.
WindowOrWorkerGlobalScope.btoa()
Creates a base-64 encoded ASCII string from a string of binary data.
WindowOrWorkerGlobalScope.clearInterval()
Cancels the repeated execution set using WindowOrWorkerGlobalScope.setInterval().
WindowOrWorkerGlobalScope.clearTimeout()
Cancels the delayed execution set using WindowOrWorkerGlobalScope.setTimeout().
WindowOrWorkerGlobalScope.createImageBitmap()
Accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap. Optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh.
WindowOrWorkerGlobalScope.fetch()
Starts the process of fetching a resource from the network.
EventTarget.removeEventListener
Removes an event listener from the window.
WindowOrWorkerGlobalScope.setInterval()
Schedules a function to execute every time a given number of milliseconds elapses.
WindowOrWorkerGlobalScope.setTimeout()
Schedules a function to execute in a given amount of time.

Obsolete methods

Window.showModalDialog()
Displays a modal dialog. This method was removed completely in Chrome 43, and Firefox 55.

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 EventTarget interface and implements event handlers from 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.

Window.onappinstalled
Called when the page is installed as a webapp. See appinstalled event.
Window.onbeforeinstallprompt
An event handler property dispatched before a user is prompted to save a web site to a home screen on mobile.
Window.ondevicelight
An event handler property for any ambient light levels changes
Window.ondevicemotion
Called if accelerometer detects a change (For mobile devices)
Window.ondeviceorientation
Called when the orientation is changed (For mobile devices)
Window.ondeviceorientationabsolute Chrome only
An event handler property for any device orientation changes.
Window.ondeviceproximity
An event handler property for device proximity event
Window.ongamepadconnected
Represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires).
Window.ongamepaddisconnected
Represents an event handler that will run when a gamepad is disconnected (when the gamepaddisconnected event fires).
Window.onmozbeforepaint
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 Window.mozRequestAnimationFrame() method.
Window.onpaint
An event handler property for paint events on the window.
Window.onrejectionhandled
An event handler for handled Promise rejection events.
Window.onuserproximity
An event handler property for user proximity events.
Window.onvrdisplayconnect
Represents an event handler that will run when a compatible VR device has been connected to the computer (when the vrdisplayconnected event fires).
Window.onvrdisplaydisconnect
Represents an event handler that will run when a compatible VR device has been disconnected from the computer (when the vrdisplaydisconnected event fires).
Window.onvrdisplayactivate
Represents an event handler that will run when a display is able to be presented to (when the vrdisplayactivate event fires), for example if an HMD has been moved to bring it out of standby, or woken up by being put on.
Window.onvrdisplaydeactivate
Represents an event handler that will run when a display can no longer be presented to (when the vrdisplaydeactivate event fires), for example if an HMD has gone into standby or sleep mode due to a period of inactivity.
Window.onvrdisplayblur
Represents an event handler that will run when presentation to a display has been paused for some reason by the browser, OS, or VR hardware (when the vrdisplayblur event fires) — for example, while the user is interacting with a system menu or browser, to prevent tracking or loss of experience.
Window.onvrdisplayfocus
Represents an event handler that will run when presentation to a display has resumed after being blurred (when the vrdisplayfocus event fires).
Window.onvrdisplaypresentchange
represents an event handler that will run when the presenting state of a VR device changes — i.e. goes from presenting to not presenting, or vice versa (when the vrdisplaypresentchange event fires).

Event handlers implemented from elsewhere

GlobalEventHandlers.onabort
Called when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress
WindowEventHandlers.onafterprint
Called when the print dialog box is closed. See afterprint event.
WindowEventHandlers.onbeforeprint
Called when the print dialog box is opened. See beforeprint event.
WindowEventHandlers.onbeforeunload
An event handler property for before-unload events on the window.
GlobalEventHandlers.onblur
Called after the window loses focus, such as due to a popup.
GlobalEventHandlers.onchange
An event handler property for change events on the window.
GlobalEventHandlers.onclick
Called after the ANY mouse button is pressed & released
GlobalEventHandlers.ondblclick
Called when a double click is made with ANY mouse button.
GlobalEventHandlers.onclose
Called after the window is closed
GlobalEventHandlers.oncontextmenu
Called when the RIGHT mouse button is pressed
GlobalEventHandlers.onerror
Called when a resource fails to load OR when an error occurs at runtime. See error event.
GlobalEventHandlers.onfocus
Called after the window receives or regains focus. See focus events.
WindowEventHandlers.onhashchange
An event handler property for hashchange events on the window; called when the part of the URL after the hash mark ("#") changes.
GlobalEventHandlers.oninput
Called when the value of an <input> element changes
GlobalEventHandlers.onkeydown
Called when you begin pressing ANY key. See keydown event.
GlobalEventHandlers.onkeypress
Called when a key (except Shift, Fn, and CapsLock) is in pressed position. See keypress event.
GlobalEventHandlers.onkeyup
Called when you finish releasing ANY key. See keyup event.
WindowEventHandlers.onlanguagechange
An event handler property for languagechange events on the window.
GlobalEventHandlers.onload
Called after all resources and the DOM are fully loaded. WILL NOT get called when the page is loaded from cache, such as with back button.
WindowEventHandlers.onmessage
Is an EventHandler representing the code to be called when the message event is raised.
GlobalEventHandlers.onmousedown
Called when ANY mouse button is pressed.
GlobalEventHandlers.onmousemove
Called continously when the mouse is moved inside the window.
GlobalEventHandlers.onmouseout
Called when the pointer leaves the window.
GlobalEventHandlers.onmouseover
Called when the pointer enters the window
GlobalEventHandlers.onmouseup
Called when ANY mouse button is released
WindowEventHandlers.onoffline
Called when network connection is lost. See offline event.
WindowEventHandlers.ononline
Called when network connection is established. See online event.
WindowEventHandlers.onpagehide
Called when the user navigates away from the page, before the onunload event. See pagehide event.
WindowEventHandlers.onpageshow
Called after all resources and the DOM are fully loaded. See pageshow event.
WindowEventHandlers.onpopstate
Called when a back button is pressed.
GlobalEventHandlers.onreset
Called when a form is reset
GlobalEventHandlers.onresize
Called continuously as you are resizing the window.
GlobalEventHandlers.onscroll
Called when the scroll bar is moved via ANY means. If the resource fully fits in the window, then this event cannot be invoked
GlobalEventHandlers.onwheel
Called when the mouse wheel is rotated around any axis
GlobalEventHandlers.onselect
Called after text in an input field is selected
GlobalEventHandlers.onselectionchange
Is an EventHandler representing the code to be called when the selectionchange event is raised.
WindowEventHandlers.onstorage
Called when there is a change in session storage or local storage. See storage event
GlobalEventHandlers.onsubmit
Called when a form is submitted
WindowEventHandlers.onunhandledrejection
An event handler for unhandled Promise rejection events.
WindowEventHandlers.onunload
Called when the user navigates away from the page.

Constructors

See also the DOM Interfaces.

DOMParser
DOMParser can parse XML or HTML source stored in a string into a DOM Document. DOMParser is specified in DOM Parsing and Serialization.
Window.GeckoActiveXObject
Image
Used for creating an HTMLImageElement.
Option
Used for creating an HTMLOptionElement
Window.QueryInterface
Window.StaticRange Read only
Returns a StaticRange() constructor which creates a StaticRange object.
Worker
Used for creating a Web worker
Window.XMLSerializer
Window.XPCNativeWrapper
Window.XPCSafeJSObjectWrapper

Interfaces

See DOM Reference

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 1 12 1 Yes Yes Yes
alert Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes Yes Yes
Yes
Starting with Opera 53, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes
blur Yes Yes Yes Yes Yes Yes
confirm Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes Yes Yes
Yes
In Opera, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes
cancelAnimationFrame Yes Yes 23
23
11 — 23
Prefixed
Prefixed Implemented with the vendor prefix: moz
10 15 6.1
6.1
6 — 6.1
Prefixed
Prefixed Implemented with the vendor prefix: webkit
cancelIdleCallback 47 No 55
55
53
Disabled
Disabled From version 53: this feature is behind the dom.requestIdleCallback.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No Yes No
clearImmediate No ? No Yes No No
close Yes Yes Yes
Yes
Starting in Firefox 46.0.1, Window.close() can no longer close windows that weren't opened by the same script. This is a security precaution.
Yes Yes Yes
focus Yes Yes Yes Yes Yes Yes
ondevicelight No Yes 22 — 60 No No No
convertPointFromNodeToPage Yes Yes 6 ? ? Yes
Yes
Uses the non-standard name: webkitConvertPointFromNodeToPage
convertPointFromPageToNode 50
50
For absolute values, use ondeviceorientationabsolute.
7 — 50
Provided absolute values, not relative.
Yes 6
6
3.6 — 6
Uses the non-standard name: onmozorientation
? ? Yes
Yes
Uses the non-standard name: webkitConvertPointFromPageToNode
ondeviceorientationabsolute 50 ? No ? ? ?
ondeviceproximity No ? ? — 60 No No No
ongamepadconnected 35
35
21 — 35
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes 29 No 22
22
15 — 22
Prefixed
Prefixed Implemented with the vendor prefix: webkit
10.1
ongamepaddisconnected 35
35
21 — 35
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes 29 No 22
22
15 — 22
Prefixed
Prefixed Implemented with the vendor prefix: webkit
10.1
onpaint No ? No ? ? ?
onuserproximity No ? Yes No No No
onvrdisplayactivate No No 55 No No No
onvrdisplayblur No No No No No No
onvrdisplayconnect No
Disabled
No
Disabled
Disabled This feature is behind the WebVR preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? 63
63
Only Windows and macOS support is enabled.
55
Only Windows support is enabled.
No No No
onvrdisplaydeactivate No No 55 No No No
onvrdisplaydisconnect No
Disabled
No
Disabled
Disabled This feature is behind the WebVR preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? 63
63
Only Windows and macOS support is enabled.
55
Only Windows support is enabled.
No No No
onvrdisplayfocus No No No No No No
onvrdisplaypresentchange 65
Disabled
65
Disabled
Disabled From version 65: this feature is behind the WebVR preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? 63
63
Only Windows and macOS support is enabled.
55
Only Windows support is enabled.
No No No
crypto 37 12 34 11
Prefixed
11
Prefixed
Prefixed Implemented with the vendor prefix: ms
24 6.1
customElements 54 No
No
Under consideration
63
63
59
Disabled
Disabled From version 59: this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? — 59
Disabled
Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No 41 10.1
devicePixelRatio Yes Yes 49 11 41 9.1
dialogArguments ? ? ? ? ? ?
document Yes Yes Yes Yes Yes Yes
event Yes Yes 64 Yes Yes Yes
frameElement Yes Yes 1 Yes Yes Yes
frames Yes Yes Yes Yes Yes Yes
fullScreen No ? 3 No ? ?
getAttention No No No No No No
getAttentionWithCycleCount No No No No No No
getComputedStyle Yes Yes Yes
Yes
Before version 62 this function returned null when called on a Window with no presentation (e.g. an iframe with display: none; set). Since 62 it returns a CSSStyleDeclaration object with length 0, containing empty strings (bug 1467722; also see bug 1471231 for further work).
9 Yes Yes
getDefaultComputedStyle No No 19 No No No
getSelection Yes Yes Yes 9 Yes Yes
globalStorage No ? ? — 13 ? ? ?
history Yes ? Yes ? ? ?
home No ? 1 No Yes No
innerHeight 1 Yes 1
1
4 — 24
This property was buggy and could give a wrong value before page load in certain circumstances, see bug 641188.
9 9 3
innerWidth 1 Yes 1
1
4 — 24
This property was buggy and could give a wrong value before page load in certain circumstances, see bug 641188.
9 9 3
isSecureContext Yes Yes 49 ? ? ?
length Yes ? Yes ? ? ?
localStorage 4 Yes 3.5 8 10.5 4
location Yes Yes Yes
Yes
Before Firefox 57, single quotes contained in URLs were escaped when accessed via URL APIs. See bug 1386683.
Yes Yes Yes
locationbar Yes ? ? ? ? ?
matchMedia 9 Yes 6 10 12.1 5.1
maximize No ? No ? ? ?
menubar Yes ? Yes ? ? ?
minimize No ? No ? ? ?
moveBy Yes ? Yes ? ? ?
moveTo Yes ? Yes ? ? ?
mozAnimationStartTime No No No No No No
mozInnerScreenX No No Yes No No No
mozInnerScreenY No No Yes No No No
mozPaintCount No No No No No No
name Yes ? Yes ? ? ?
navigator Yes ? Yes ? ? ?
onappinstalled Yes ? 49
Disabled
49
Disabled
Disabled From version 49: this feature is behind the dom.manifest.onappinstall preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? ? ?
onbeforeinstallprompt ? ? ? ? ? ?
ondevicemotion ? ? ? ? ? ?
ondeviceorientation ? ? ? ? ? ?
open Yes Yes Yes Yes ? ?
openDialog No ? No ? ? ?
opener Yes ? Yes ? ? ?
orientation No ? No ? ? ?
outerHeight 1 Yes 1 9 9 3
outerWidth 1 Yes 1 9 9 3
pageXOffset Yes Yes Yes 9 Yes Yes
pageYOffset Yes Yes Yes 9 Yes Yes
parent Yes ? Yes ? ? ?
performance 6 Yes 7 9 15 8
personalbar Yes ? Yes ? ? ?
pkcs11 No ? ? — 29 ? ? ?
postMessage 1 Yes 8
8
Supports sending File and FileList objects between windows. This is only allowed if the recipient's principal is contained within the sender's principal for security reasons.
6
The message parameter is serialized using the structured clone algorithm. This means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself.
? — 6
The message parameter must be a string.
10
10
IE10 had an important limitation: see this article for details.
8 — 10
Support only for <frame> and <iframe>.
9.5 4
print Yes
Yes
Starting with Chrome 46.0 this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
? Yes ? ? ?
prompt Yes
Yes
Starting with Chrome 46.0 this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
? Yes Yes
Yes
This function has no effect in the Modern UI/Metro version of Internet Explorer for Windows 8. It does not display a prompt to the user, and always returns undefined. It is not clear whether this is a bug or intended behavior. Desktop versions of IE do implement this function.
? ?
releaseEvents Yes ? Yes ? ? ?
requestAnimationFrame 24
24
10
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes 23
23
Callback parameter is a DOMHighResTimestamp. This means ten microsecond precision and zero time as performance.now().
11 — 42
Prefixed
Prefixed Implemented with the vendor prefix: moz
Callback parameter is a DOMTimestamp. This means millisecond precision and zero time as Date.now().
4 — 11
Prefixed
Prefixed Implemented with the vendor prefix: moz
Could be called with no input parameters.
10 15
15
Yes
Prefixed
Prefixed Implemented with the vendor prefix: o
6.1
6.1
6
Prefixed
Prefixed Implemented with the vendor prefix: webkit
requestFileSystem 13
Prefixed
13
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes No No No No
requestIdleCallback 47 No 55
55
Enabled by default.
53 — 55
Implemented but disabled by default.
No 34 No
resizeBy Yes ? Yes
Yes
Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser if the window wasn’t created by window.open or contains more than one tab. See here for more details.
? ? ?
resizeTo Yes ? Yes
Yes
Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser if the window wasn’t created by window.open or contains more than one tab. See here for more details.
? ? ?
restore No ? No ? ? ?
returnValue No ? No ? ? ?
routeEvent No ? No ? ? ?
screen Yes ? Yes ? ? ?
screenX Yes Yes Yes
Yes
Before Firefox 28, Gecko was using device pixels instead of CSS pixels; in other words, it was assuming a value of screenPixelsPerCSSPixel of 1 for any device.
Yes Yes Yes
screenY Yes Yes Yes
Yes
Before Firefox 28, Gecko was using device pixels instead of CSS pixels; in other words, it was assuming a value of screenPixelsPerCSSPixel of 1 for any device.
Yes Yes Yes
scroll Yes Yes Yes ? ? Yes
scrollbars Yes ? Yes ? ? Yes
scrollBy Yes Partial
Partial
Only scrollBy(x-coord, y-coord) is supported.
Yes 11
11
Only scrollBy(x-coord, y-coord) is supported.
? Yes
scrollByLines No ? Yes ? ? No
scrollByPages No ? Yes ? ? No
scrollMaxX No ? Yes ? ? No
scrollMaxY No ? Yes ? ? ?
scrollTo Yes Yes Yes Yes Yes Yes
scrollX Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
No
No
9
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
scrollY Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
No
No
9
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
self Yes Yes Yes Yes Yes Yes
sessionStorage 5 Yes 2 8 10.5 4
setCursor No ? No ? ? ?
setImmediate No Yes No 10 No No
setResizable No ? Yes ? ? ?
showModalDialog ? — 43 No 3 — 56 4 No 5.1
5.1
See WebKit bug 151885 for possible future removal from Safari.
sidebar No ? Yes ? ? ?
sizeToContent No ? Yes
Yes
20
The mimimal size is clamped to prevent the window from being too small for the user to interact with.
? ? ?
speechSynthesis 33 Yes 49 No ? 7
status Yes ? Yes ? ? ?
statusbar Yes ? Yes ? ? ?
stop Yes ? Yes No ? ?
toolbar Yes ? Yes ? ? ?
top Yes Yes Yes
Yes
Starting in Firefox 6, this property is read only, as defined by the standard.
Yes Yes Yes
updateCommands No ? Yes ? ? ?
visualViewport 60 ? 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the dom.visualviewport.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? 47 ?
window Yes ? Yes ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes 18 12 4 Yes Yes Yes
alert Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes Yes
Yes
Starting with Opera 53, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes
blur Yes Yes Yes Yes Yes Yes Yes
confirm Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes
Yes
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes Yes
Yes
In Opera, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
Yes Yes
cancelAnimationFrame Yes Yes Yes 23
23
14 — 23
Prefixed
Prefixed Implemented with the vendor prefix: moz
33 7.1 ?
cancelIdleCallback 47 47 ? 55
55
53
Disabled
Disabled From version 53: this feature is behind the dom.requestIdleCallback.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? No ?
clearImmediate No ? ? No No No ?
close Yes Yes Yes Yes
Yes
Starting in Firefox 46.0.1, Window.close() can no longer close windows that weren't opened by the same script. This is a security precaution.
Yes Yes ?
focus Yes Yes Yes Yes Yes Yes Yes
ondevicelight No No ? 15 No No ?
convertPointFromNodeToPage Yes Yes Yes 6 No Yes ?
convertPointFromPageToNode 50
50
For absolute values, use ondeviceorientationabsolute.
? — 50
Provided absolute values, not relative.
50
50
For absolute values, use ondeviceorientationabsolute.
? — 50
Provided absolute values, not relative.
Yes 6
6
4 — 6
Uses the non-standard name: onmozorientation
No Yes ?
ondeviceorientationabsolute 50 50 ? No ? ? ?
ondeviceproximity No No ? 15 No No ?
ongamepadconnected ? ? Yes 32 No No Yes
ongamepaddisconnected ? ? Yes 32 No No Yes
onpaint Yes No ? No ? ? ?
onuserproximity No No ? 15 — 60 No No ?
onvrdisplayactivate No No No 55 No No No
onvrdisplayblur No No No No No No No
onvrdisplayconnect ? Yes
Yes
Chrome for Android 56 supports only Google Daydream View.
Chrome for Android 57 adds support for Google Cardboard.
? 55 No No Yes
Yes
Supported on Samsung Internet for GearVR.
onvrdisplaydeactivate No No No 55 No No No
onvrdisplaydisconnect ? 56
56
Chrome for Android 56 supports only Google Daydream View.
Chrome for Android 57 adds support for Google Cardboard.
? 55 No No Yes
Yes
Supported on Samsung Internet for GearVR.
onvrdisplayfocus No No No No No No No
onvrdisplaypresentchange ? 56
56
Chrome for Android 56 supports only Google Daydream View.
Chrome for Android 57 adds support for Google Cardboard.
? 55 No No Yes
Yes
Supported on Samsung Internet for GearVR.
crypto 37 37 12 34 24 6.1 Yes
customElements 54 54 No
No
Under consideration
63
63
59
Disabled
Disabled From version 59: this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? — 59
Disabled
Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
41 10.1 ?
devicePixelRatio Yes Yes Yes ? Yes 9.3 ?
dialogArguments ? ? ? ? ? ? ?
document Yes Yes Yes Yes Yes Yes Yes
event ? Yes Yes 64 Yes Yes ?
frameElement ? ? Yes Yes ? ? ?
frames Yes Yes Yes Yes Yes Yes Yes
fullScreen ? No ? ? ? ? ?
getAttention No No No No No No ?
getAttentionWithCycleCount No No No No No No ?
getComputedStyle Yes Yes Yes Yes
Yes
Before version 62 this function returned null when called on a Window with no presentation (e.g. an iframe with display: none; set). Since 62 it returns a CSSStyleDeclaration object with length 0, containing empty strings (bug 1467722; also see bug 1471231 for further work).
Yes Yes ?
getDefaultComputedStyle No No No 19 No No ?
getSelection ? ? Yes 55
55
No support for selection events.
37 5.1
5.1
No support for selection start.
?
globalStorage No No ? No ? ? ?
history Yes Yes ? Yes ? ? ?
home No No ? ? ? No ?
innerHeight Yes Yes Yes 4
4
4 — 24
This property was buggy and could give a wrong value before page load in certain circumstances, see bug 641188.
9 3 ?
innerWidth Yes Yes Yes 4
4
4 — 24
This property was buggy and could give a wrong value before page load in certain circumstances, see bug 641188.
9 3 ?
isSecureContext Yes Yes Yes 49 ? ? ?
length Yes Yes ? Yes ? ? ?
localStorage Yes Yes Yes Yes 11 3.2 ?
location Yes Yes Yes Yes
Yes
Before Firefox 57, single quotes contained in URLs were escaped when accessed via URL APIs. See bug 1386683.
Yes Yes ?
locationbar Yes Yes ? ? ? ? ?
matchMedia ? ? Yes 6 12.1 5 ?
maximize No No ? No ? ? ?
menubar Yes Yes ? Yes ? ? ?
minimize No No ? No ? ? ?
moveBy Yes Yes ? Yes ? ? ?
moveTo Yes Yes ? Yes ? ? ?
mozAnimationStartTime No No No No No No No
mozInnerScreenX No No No Yes No No No
mozInnerScreenY No No No Yes No No No
mozPaintCount No No No No No No No
name Yes Yes ? Yes ? ? ?
navigator Yes Yes ? Yes ? ? ?
onappinstalled ? Yes ? 49
Disabled
49
Disabled
Disabled From version 49: this feature is behind the dom.manifest.onappinstall preference (needs to be set to true). To change preferences in Firefox, visit about:config.
? ? ?
onbeforeinstallprompt ? ? ? ? ? ? ?
ondevicemotion ? ? ? ? ? ? ?
ondeviceorientation ? ? ? ? ? ? ?
open Yes Yes ? Yes ? ? ?
openDialog No No ? No ? ? ?
opener Yes Yes ? Yes ? ? ?
orientation No No ? No ? ? ?
outerHeight Yes Yes Yes 4 9 3 ?
outerWidth Yes Yes Yes 4 9 3 ?
pageXOffset ? Yes Yes Yes ? ? ?
pageYOffset ? Yes Yes Yes ? ? ?
parent Yes Yes ? Yes ? ? ?
performance Yes Yes Yes 7 15 9 ?
personalbar Yes Yes ? Yes ? ? ?
pkcs11 No No ? ? — 29 ? ? ?
postMessage Yes Yes Yes 8
8
Supports sending File and FileList objects between windows. This is only allowed if the recipient's principal is contained within the sender's principal for security reasons.
6
The message parameter is serialized using the structured clone algorithm. This means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself.
? — 6
The message parameter must be a string.
Yes Yes
Yes
For security reasons, to work properly on Safari, construct using document.getElementById('your-frame').contentWindow.
?
print Yes Yes ? Yes ? ? ?
prompt Yes Yes ? Yes ? ? ?
releaseEvents Yes Yes ? Yes ? ? ?
requestAnimationFrame Yes 25
25
18
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes 23
23
14 — 42
Prefixed
Prefixed Implemented with the vendor prefix: moz
15 7.1
7.1
6.1
Prefixed
Prefixed Implemented with the vendor prefix: webkit
?
requestFileSystem ? Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Yes No No No ?
requestIdleCallback 47 47 No 55
55
Enabled by default.
53 — 55
Implemented but disabled by default.
? No ?
resizeBy Yes Yes ? Yes ? ? ?
resizeTo Yes Yes ? Yes ? ? ?
restore No No ? No ? ? ?
returnValue No No ? No ? ? ?
routeEvent No No ? No ? ? ?
screen Yes Yes ? Yes ? ? ?
screenX Yes Yes Yes Yes
Yes
Before Firefox 28, Gecko was using device pixels instead of CSS pixels; in other words, it was assuming a value of screenPixelsPerCSSPixel of 1 for any device.
Yes Yes ?
screenY Yes Yes Yes Yes
Yes
Before Firefox 28, Gecko was using device pixels instead of CSS pixels; in other words, it was assuming a value of screenPixelsPerCSSPixel of 1 for any device.
Yes Yes ?
scroll Yes Yes ? Yes ? Yes ?
scrollbars Yes Yes ? Yes ? Yes ?
scrollBy Yes Yes ? Yes ? Yes ?
scrollByLines No No ? Yes ? No ?
scrollByPages No No ? Yes ? No ?
scrollMaxX No No ? Yes ? No ?
scrollMaxY No No ? Yes ? ? ?
scrollTo Yes Yes Yes Yes ? Yes Yes
scrollX Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
Yes
Yes
Yes
Uses the non-standard name: pageXOffset
?
?
?
Uses the non-standard name: pageXOffset
?
?
?
Uses the non-standard name: pageXOffset
?
?
?
Uses the non-standard name: pageXOffset
scrollY Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
Yes
Yes
Yes
Uses the non-standard name: pageYOffset
?
?
?
Uses the non-standard name: pageYOffset
Yes
Yes
?
Uses the non-standard name: pageYOffset
?
?
?
Uses the non-standard name: pageYOffset
self Yes Yes Yes Yes Yes Yes ?
sessionStorage Yes Yes Yes Yes 11 3.2 ?
setCursor No No ? No ? ? ?
setImmediate No No Yes No No No ?
setResizable No No ? Yes ? ? ?
showModalDialog No No No No No No No
sidebar No No ? Yes ? ? ?
sizeToContent No No ? Yes
Yes
This method has no effect as a page is always in a tab.
? ? ?
speechSynthesis ? Yes Yes No No 7.1 ?
status Yes Yes ? Yes ? ? ?
statusbar Yes Yes ? Yes ? ? ?
stop Yes Yes ? Yes ? ? ?
toolbar Yes Yes ? Yes ? ? ?
top ? ? Yes ? ? ? ?
updateCommands No No ? Yes ? ? ?
visualViewport 60 60 ? 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the dom.visualviewport.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
47 ? ?
window Yes Yes ? Yes ? ? ?

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window