Definition
HTML Standard defines Window
[Global=Window,
Exposed=Window,
LegacyUnenumerableNamedProperties]
interface Window : EventTarget {
// the current browsing context
[LegacyUnforgeable] readonly attribute WindowProxy window;
[Replaceable] readonly attribute WindowProxy self;
[LegacyUnforgeable] readonly attribute Document document;
attribute DOMString name;
[PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
readonly attribute History history;
readonly attribute CustomElementRegistry customElements;
[Replaceable] readonly attribute BarProp locationbar;
[Replaceable] readonly attribute BarProp personalbar;
[Replaceable] readonly attribute BarProp scrollbars;
[Replaceable] readonly attribute BarProp statusbar;
[Replaceable] readonly attribute BarProp toolbar;
attribute DOMString status;
undefined close();
readonly attribute boolean closed;
undefined stop();
undefined focus();
undefined blur();
// other browsing contexts
[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
[LegacyUnforgeable] readonly attribute WindowProxy? top;
attribute any opener;
[Replaceable] readonly attribute WindowProxy? parent;
readonly attribute Element? frameElement;
WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");
// Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
// object on the prototype chain. Indeed, this does not make the global object an exotic object.
// Indexed access is taken care of by the WindowProxy exotic object.
getter object (DOMString name);
[Replaceable] readonly attribute Navigator clientInformation; // legacy alias of .navigator
readonly attribute boolean originAgentCluster;
// user prompts
undefined alert();
undefined alert(DOMString message);
boolean confirm(optional DOMString message = "");
DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
undefined print();
undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
undefined postMessage(any message, optional WindowPostMessageOptions options = {});
// also has obsolete members
};
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;
Window includes WindowOrWorkerGlobalScope;
Window includes AnimationFrameProvider;
Window includes WindowSessionStorage;
Window includes WindowLocalStorage;
partial interface Window {
undefined captureEvents();
undefined releaseEvents();
[Replaceable, SameObject] readonly attribute External external;
};
This interface is extended in the following specifications:
- Compatibility Standard
partial interface Window { readonly attribute short orientation; attribute EventHandler onorientationchange; }; - Cookie Store API Standard
[SecureContext] partial interface Window { [SameObject] readonly attribute CookieStore cookieStore; }; - DOM Standard
partial interface Window { [Replaceable] readonly attribute (Event or undefined) event; // legacy }; - Fetch Standard
partial interface Window { [NewObject, SecureContext] FetchLaterResult fetchLater(RequestInfo input, optional DeferredRequestInit init = {}); }; - Web Speech API
partial interface Window { [SameObject] readonly attribute SpeechSynthesis speechSynthesis; }; - Iframe credentialless
partial interface Window { readonly attribute boolean credentialless; }; - Digital Goods API
partial interface Window { [SecureContext] Promise<DigitalGoodsService> getDigitalGoodsService( DOMString serviceProvider); }; - Document Picture-in-Picture Specification
[Exposed=Window] partial interface Window { [SameObject, SecureContext] readonly attribute DocumentPictureInPicture documentPictureInPicture; }; - Fenced Frame
partial interface Window { // Collection of fenced frame APIs readonly attribute Fence? fence; }; - File System Access
[SecureContext] partial interface Window { Promise<sequence<FileSystemFileHandle>> showOpenFilePicker(optional OpenFilePickerOptions options = {}); Promise<FileSystemFileHandle> showSaveFilePicker(optional SaveFilePickerOptions options = {}); Promise<FileSystemDirectoryHandle> showDirectoryPicker(optional DirectoryPickerOptions options = {}); }; - Local Font Access API
[SecureContext] partial interface Window { Promise<sequence<FontData>> queryLocalFonts(optional QueryOptions options = {}); }; - Manifest Incubations
partial interface Window { attribute EventHandler onappinstalled; attribute EventHandler onbeforeinstallprompt; }; - Portals
partial interface Window { readonly attribute PortalHost? portalHost; }; - Shared Storage API
partial interface Window { }; - Web App Launch Handler API
partial interface Window { readonly attribute LaunchQueue launchQueue; }; - CSS Spatial Navigation Module Level 1
partial interface Window { }; - CSS Viewport Module Level 1
partial interface Window { [SameObject, Replaceable] readonly attribute Viewport viewport; }; - CSS Object Model (CSSOM) Module Level 1
partial interface Window { [NewObject] CSSStyleProperties getComputedStyle(Element elt, optional CSSOMString? pseudoElt); }; - CSSOM View Module Level 1
partial interface Window { [NewObject] MediaQueryList matchMedia(CSSOMString query); [SameObject, Replaceable] readonly attribute Screen screen; [SameObject, Replaceable] readonly attribute VisualViewport? visualViewport; // browsing context undefined moveTo(long x, long y); undefined moveBy(long x, long y); undefined resizeTo(long width, long height); undefined resizeBy(long x, long y); // viewport [Replaceable] readonly attribute long innerWidth; [Replaceable] readonly attribute long innerHeight; // viewport scrolling [Replaceable] readonly attribute double scrollX; [Replaceable] readonly attribute double pageXOffset; [Replaceable] readonly attribute double scrollY; [Replaceable] readonly attribute double pageYOffset; Promise<undefined> scroll(optional ScrollToOptions options = {}); Promise<undefined> scroll(unrestricted double x, unrestricted double y); Promise<undefined> scrollTo(optional ScrollToOptions options = {}); Promise<undefined> scrollTo(unrestricted double x, unrestricted double y); Promise<undefined> scrollBy(optional ScrollToOptions options = {}); Promise<undefined> scrollBy(unrestricted double x, unrestricted double y); // client [Replaceable] readonly attribute long screenX; [Replaceable] readonly attribute long screenLeft; [Replaceable] readonly attribute long screenY; [Replaceable] readonly attribute long screenTop; [Replaceable] readonly attribute long outerWidth; [Replaceable] readonly attribute long outerHeight; [Replaceable] readonly attribute double devicePixelRatio; }; - Device Orientation and Motion
partial interface Window { [SecureContext] attribute EventHandler ondeviceorientation; }; partial interface Window { [SecureContext] attribute EventHandler ondeviceorientationabsolute; }; partial interface Window { [SecureContext] attribute EventHandler ondevicemotion; }; - Push API
Window includes PushManagerAttribute; - requestIdleCallback()
partial interface Window { unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {}); undefined cancelIdleCallback(unsigned long handle); }; - Selection API
partial interface Window { Selection? getSelection(); }; - Window Management
partial interface Window { [SecureContext] Promise<ScreenDetails> getScreenDetails(); };
Consolidated IDL (across mixin and partials)
[Global=Window,
Exposed=Window,
LegacyUnenumerableNamedProperties]
interface Window : EventTarget {
// the current browsing context
[LegacyUnforgeable] readonly attribute WindowProxy window;
[Replaceable] readonly attribute WindowProxy self;
[LegacyUnforgeable] readonly attribute Document document;
attribute DOMString name;
[PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
readonly attribute History history;
readonly attribute CustomElementRegistry customElements;
[Replaceable] readonly attribute BarProp locationbar;
[Replaceable] readonly attribute BarProp personalbar;
[Replaceable] readonly attribute BarProp scrollbars;
[Replaceable] readonly attribute BarProp statusbar;
[Replaceable] readonly attribute BarProp toolbar;
attribute DOMString status;
undefined close();
readonly attribute boolean closed;
undefined stop();
undefined focus();
undefined blur();
// other browsing contexts
[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
[LegacyUnforgeable] readonly attribute WindowProxy? top;
attribute any opener;
[Replaceable] readonly attribute WindowProxy? parent;
readonly attribute Element? frameElement;
WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");
// Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
// object on the prototype chain. Indeed, this does not make the global object an exotic object.
// Indexed access is taken care of by the WindowProxy exotic object.
getter object (DOMString name);
[Replaceable] readonly attribute Navigator clientInformation; // legacy alias of .navigator
readonly attribute boolean originAgentCluster;
// user prompts
undefined alert();
undefined alert(DOMString message);
boolean confirm(optional DOMString message = "");
DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
undefined print();
undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
undefined postMessage(any message, optional WindowPostMessageOptions options = {});
undefined captureEvents();
undefined releaseEvents();
[Replaceable, SameObject] readonly attribute External external;
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncommand;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
[LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
attribute EventHandler onafterprint;
attribute EventHandler onbeforeprint;
attribute OnBeforeUnloadEventHandler onbeforeunload;
attribute EventHandler onhashchange;
attribute EventHandler onlanguagechange;
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
attribute EventHandler onoffline;
attribute EventHandler ononline;
attribute EventHandler onpagehide;
attribute EventHandler onpagereveal;
attribute EventHandler onpageshow;
attribute EventHandler onpageswap;
attribute EventHandler onpopstate;
attribute EventHandler onrejectionhandled;
attribute EventHandler onstorage;
attribute EventHandler onunhandledrejection;
attribute EventHandler onunload;
[Replaceable] readonly attribute USVString origin;
readonly attribute boolean isSecureContext;
readonly attribute boolean crossOriginIsolated;
undefined reportError(any e);
// base64 utility methods
DOMString btoa(DOMString data);
ByteString atob(DOMString data);
// timers
long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments);
undefined clearTimeout(optional long id = 0);
long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
undefined clearInterval(optional long id = 0);
// microtask queuing
undefined queueMicrotask(VoidFunction callback);
// ImageBitmap
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {});
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options = {});
// structured cloning
any structuredClone(any value, optional StructuredSerializeOptions options = {});
unsigned long requestAnimationFrame(FrameRequestCallback callback);
undefined cancelAnimationFrame(unsigned long handle);
readonly attribute Storage sessionStorage;
readonly attribute Storage localStorage;
readonly attribute short orientation;
attribute EventHandler onorientationchange;
[SameObject] readonly attribute CookieStore cookieStore;
[Replaceable] readonly attribute (Event or undefined) event;
[NewObject, SecureContext] FetchLaterResult fetchLater(RequestInfo input, optional DeferredRequestInit init = {});
[SameObject] readonly attribute SpeechSynthesis speechSynthesis;
readonly attribute boolean credentialless;
[SecureContext] Promise<DigitalGoodsService> getDigitalGoodsService(
DOMString serviceProvider);
[SameObject, SecureContext] readonly attribute DocumentPictureInPicture
documentPictureInPicture;
// Collection of fenced frame APIs
readonly attribute Fence? fence;
Promise<sequence<FileSystemFileHandle>> showOpenFilePicker(optional OpenFilePickerOptions options = {});
Promise<FileSystemFileHandle> showSaveFilePicker(optional SaveFilePickerOptions options = {});
Promise<FileSystemDirectoryHandle> showDirectoryPicker(optional DirectoryPickerOptions options = {});
Promise<sequence<FontData>> queryLocalFonts(optional QueryOptions options = {});
attribute EventHandler onappinstalled;
attribute EventHandler onbeforeinstallprompt;
readonly attribute PortalHost? portalHost;
readonly attribute LaunchQueue launchQueue;
[SameObject, Replaceable] readonly attribute Viewport viewport;
[NewObject] CSSStyleProperties getComputedStyle(Element elt, optional CSSOMString? pseudoElt);
[NewObject] MediaQueryList matchMedia(CSSOMString query);
[SameObject, Replaceable] readonly attribute Screen screen;
[SameObject, Replaceable] readonly attribute VisualViewport? visualViewport;
// browsing context
undefined moveTo(long x, long y);
undefined moveBy(long x, long y);
undefined resizeTo(long width, long height);
undefined resizeBy(long x, long y);
// viewport
[Replaceable] readonly attribute long innerWidth;
[Replaceable] readonly attribute long innerHeight;
// viewport scrolling
[Replaceable] readonly attribute double scrollX;
[Replaceable] readonly attribute double pageXOffset;
[Replaceable] readonly attribute double scrollY;
[Replaceable] readonly attribute double pageYOffset;
Promise<undefined> scroll(optional ScrollToOptions options = {});
Promise<undefined> scroll(unrestricted double x, unrestricted double y);
Promise<undefined> scrollTo(optional ScrollToOptions options = {});
Promise<undefined> scrollTo(unrestricted double x, unrestricted double y);
Promise<undefined> scrollBy(optional ScrollToOptions options = {});
Promise<undefined> scrollBy(unrestricted double x, unrestricted double y);
// client
[Replaceable] readonly attribute long screenX;
[Replaceable] readonly attribute long screenLeft;
[Replaceable] readonly attribute long screenY;
[Replaceable] readonly attribute long screenTop;
[Replaceable] readonly attribute long outerWidth;
[Replaceable] readonly attribute long outerHeight;
[Replaceable] readonly attribute double devicePixelRatio;
[SecureContext] attribute EventHandler ondeviceorientation;
[SecureContext] attribute EventHandler ondeviceorientationabsolute;
[SecureContext] attribute EventHandler ondevicemotion;
readonly attribute PushManager pushManager;
unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {});
undefined cancelIdleCallback(unsigned long handle);
Selection? getSelection();
[SecureContext]
Promise<ScreenDetails> getScreenDetails();
// also has obsolete members
};Methods and attributes that return objects implementing Window
Referring IDL interfaces/dictionaries
Referring specifications
- Compatibility Standard refers to
Window - Cookie Store API Standard refers to
Window - DOM Standard refers to
Window - Fetch Standard refers to
Window - SVG Animations refers to
Window - Long Animation Frames API refers to
Window - Web Speech API refers to
Window - Iframe credentialless refers to
Window - Digital Goods API refers to
Window - Document Picture-in-Picture Specification refers to
Window - Fenced Frame refers to
Window - File System Access refers to
Window - Local Font Access API refers to
Window - Manifest Incubations refers to
Window - Portals refers to
Window - Shared Storage API refers to
Window - Web App Launch Handler API refers to
Window - CSS Spatial Navigation Module Level 1 refers to
Window - CSS Viewport Module Level 1 refers to
Window - CSS Object Model (CSSOM) Module Level 1 refers to
Window - CSSOM View Module Level 1 refers to
Window - Device Orientation and Motion refers to
Window - requestIdleCallback() refers to
Window - Selection API refers to
Window - UI Events refers to
Window - Window Management refers to
Window