Interface Window
caches: CacheStorage;
clientInformation: Navigator;
closed: boolean;
cookieStore: CookieStore;
crossOriginIsolated: boolean;
crypto: Crypto;
customElements: CustomElementRegistry;
devicePixelRatio: number;
document: Document;
event: Event | undefined;
external: External;
frameElement: Element | null;
frames: Window;
history: History;
indexedDB: IDBFactory;
innerHeight: number;
innerWidth: number;
isSecureContext: boolean;
length: number;
localStorage: Storage;
locationbar: BarProp;
menubar: BarProp;
name: string;
navigator: Navigator;
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onafterprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onanimationcancel:
| ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
| null;
onanimationend:
| ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
| null;
onanimationiteration:
| ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
| null;
onanimationstart:
| ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
| null;
onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onbeforeprint: ((this: WindowEventHandlers, ev: Event) => any) | null;
onbeforetoggle:
| ((this: GlobalEventHandlers, ev: ToggleEvent) => any)
| null;
onbeforeunload:
| ((this: WindowEventHandlers, ev: BeforeUnloadEvent) => any)
| null;
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncontextmenu:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
ondeviceorientation:
| ((this: Window, ev: DeviceOrientationEvent) => any)
| null;
ondeviceorientationabsolute:
| ((this: Window, ev: DeviceOrientationEvent) => any)
| null;
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onerror: OnErrorEventHandler;
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
ongamepadconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
ongamepaddisconnected:
| ((this: WindowEventHandlers, ev: GamepadEvent) => any)
| null;
ongotpointercapture:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onhashchange:
| ((this: WindowEventHandlers, ev: HashChangeEvent) => any)
| null;
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onlanguagechange: ((this: WindowEventHandlers, ev: Event) => any) | null;
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onlostpointercapture:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onmessage: ((this: WindowEventHandlers, ev: MessageEvent) => any) | null;
onmessageerror:
| ((this: WindowEventHandlers, ev: MessageEvent) => any)
| null;
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onoffline: ((this: WindowEventHandlers, ev: Event) => any) | null;
ononline: ((this: WindowEventHandlers, ev: Event) => any) | null;
onorientationchange: ((this: Window, ev: Event) => any) | null;
onpagehide:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpagereveal:
| ((this: WindowEventHandlers, ev: PageRevealEvent) => any)
| null;
onpageshow:
| ((this: WindowEventHandlers, ev: PageTransitionEvent) => any)
| null;
onpageswap: ((this: WindowEventHandlers, ev: PageSwapEvent) => any) | null;
onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onpointercancel:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointerdown:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointerenter:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointerleave:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointermove:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerover:
| ((this: GlobalEventHandlers, ev: PointerEvent) => any)
| null;
onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpopstate: ((this: WindowEventHandlers, ev: PopStateEvent) => any) | null;
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onrejectionhandled:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onsecuritypolicyviolation:
| (
(this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any
)
| null;
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onstorage: ((this: WindowEventHandlers, ev: StorageEvent) => any) | null;
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontransitioncancel:
| ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
| null;
ontransitionend:
| ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
| null;
ontransitionrun:
| ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
| null;
ontransitionstart:
| ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
| null;
onunhandledrejection:
| ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any)
| null;
onunload: ((this: WindowEventHandlers, ev: Event) => any) | null;
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onwebkitanimationend:
| ((this: GlobalEventHandlers, ev: Event) => any)
| null;
onwebkitanimationiteration:
| ((this: GlobalEventHandlers, ev: Event) => any)
| null;
onwebkitanimationstart:
| ((this: GlobalEventHandlers, ev: Event) => any)
| null;
onwebkittransitionend:
| ((this: GlobalEventHandlers, ev: Event) => any)
| null;
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
opener: any;
orientation: number;
origin: string;
originAgentCluster: boolean;
outerHeight: number;
outerWidth: number;
pageXOffset: number;
pageYOffset: number;
parent: Window;
performance: Performance;
personalbar: BarProp;
screen: Screen;
screenLeft: number;
screenTop: number;
screenX: number;
screenY: number;
scrollbars: BarProp;
scrollX: number;
scrollY: number;
self: Window & typeof globalThis;
sessionStorage: Storage;
speechSynthesis: SpeechSynthesis;
status: string;
statusbar: BarProp;
toolbar: BarProp;
top: Window | null;
visualViewport: VisualViewport | null;
window: Window & typeof globalThis;
get location(): Location;
set location(href: string): void;
addEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
alert(message?: any): void;
atob(data: string): string;
blur(): void;
btoa(data: string): string;
cancelAnimationFrame(handle: number): void;
cancelIdleCallback(handle: number): void;
captureEvents(): void;
clearInterval(id: number | undefined): void;
clearTimeout(id: number | undefined): void;
close(): void;
confirm(message?: string): boolean;
createImageBitmap(
image: ImageBitmapSource,
options?: ImageBitmapOptions,
): Promise<ImageBitmap>;
createImageBitmap(
image: ImageBitmapSource,
sx: number,
sy: number,
sw: number,
sh: number,
options?: ImageBitmapOptions,
): Promise<ImageBitmap>;
dispatchEvent(event: Event): boolean;
fetch(input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
focus(): void;
getComputedStyle(
elt: Element,
pseudoElt?: string | null,
): CSSStyleDeclaration;
getSelection(): Selection | null;
matchMedia(query: string): MediaQueryList;
moveBy(x: number, y: number): void;
moveTo(x: number, y: number): void;
open(url?: string | URL, target?: string, features?: string): Window | null;
postMessage(
message: any,
targetOrigin: string,
transfer?: Transferable[],
): void;
postMessage(message: any, options?: WindowPostMessageOptions): void;
print(): void;
prompt(message?: string, _default?: string): string | null;
queueMicrotask(callback: VoidFunction): void;
releaseEvents(): void;
removeEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
reportError(e: any): void;
requestAnimationFrame(callback: FrameRequestCallback): number;
requestIdleCallback(
callback: IdleRequestCallback,
options?: IdleRequestOptions,
): number;
resizeBy(x: number, y: number): void;
resizeTo(width: number, height: number): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
setInterval(
handler: TimerHandler,
timeout?: number,
...arguments: any[],
): number;
setTimeout(
handler: TimerHandler,
timeout?: number,
...arguments: any[],
): number;
stop(): void;
structuredClone<T = any>(value: T, options?: StructuredSerializeOptions): T;
[index: number]: Window;
}
Indexable
Index
Properties
Accessors
Methods
Properties
Readonlycaches
Available only in secure contexts.
ReadonlyclientInformation
Readonlyclosed
The Window.closed read-only property indicates whether the referenced window is closed or not.
ReadonlycookieStore
The cookieStore read-only property of the Window interface returns a reference to the CookieStore object for the current document context.
ReadonlycrossOriginIsolated
Readonlycrypto
ReadonlycustomElements
The customElements read-only property of the Window interface returns a reference to the CustomElementRegistry object, which can be used to register new custom elements and get information about previously registered custom elements.
ReadonlydevicePixelRatio
The devicePixelRatio of Window interface returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device.
Readonlydocument
window.document returns a reference to the document contained in the window.
Readonlyevent
The read-only Window property event returns the Event which is currently being handled by the site's code.
Readonlyexternal
The external property of the Window API returns an instance of the External interface, which was intended to contain functions related to adding external search providers to the browser.
ReadonlyframeElement
The Window.frameElement property returns the element (such as iframe or object) in which the window is embedded.
Readonlyframes
Returns the window itself, which is an array-like object, listing the direct sub-frames of the current window.
Readonlyhistory
The Window.history read-only property returns a reference to the History object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in).
ReadonlyindexedDB
ReadonlyinnerHeight
The read-only innerHeight property of the including the height of the horizontal scroll bar, if present.
ReadonlyinnerWidth
The read-only Window property innerWidth returns the interior width of the window in pixels (that is, the width of the window's layout viewport).
ReadonlyisSecureContext
Readonlylength
Returns the number of frames (either frame or A number.
ReadonlylocalStorage
Readonlylocationbar
Returns the locationbar object.
Readonlymenubar
Returns the menubar object.
name
The Window.name property gets/sets the name of the window's browsing context.
Readonlynavigator
The Window.navigator read-only property returns a reference to the Navigator object, which has methods and properties about the application running the script.
onabort
onafterprint
onanimationcancel
onanimationend
onanimationiteration
onanimationstart
onauxclick
onbeforeinput
onbeforematch
onbeforeprint
onbeforetoggle
onbeforeunload
onblur
oncancel
oncanplay
oncanplaythrough
onchange
onclick
onclose
oncontextlost
oncontextmenu
oncontextrestored
oncopy
oncuechange
oncut
ondblclick
ondevicemotion
Available only in secure contexts.
ondeviceorientation
Available only in secure contexts.
ondeviceorientationabsolute
Available only in secure contexts.
ondrag
ondragend
ondragenter
ondragleave
ondragover
ondragstart
ondrop
ondurationchange
onemptied
onended
onerror
onfocus
onformdata
ongamepadconnected
ongamepaddisconnected
ongotpointercapture
onhashchange
oninput
oninvalid
onkeydown
onkeypress
onkeyup
onlanguagechange
onload
onloadeddata
onloadedmetadata
onloadstart
onlostpointercapture
onmessage
onmessageerror
onmousedown
onmouseenter
onmouseleave
onmousemove
onmouseout
onmouseover
onmouseup
onoffline
ononline
onorientationchange
onpagehide
onpagereveal
onpageshow
onpageswap
onpaste
onpause
onplay
onplaying
onpointercancel
onpointerdown
onpointerenter
onpointerleave
onpointermove
onpointerout
onpointerover
onpointerrawupdate
Available only in secure contexts.
onpointerup
onpopstate
onprogress
onratechange
onrejectionhandled
onreset
onresize
onscroll
onscrollend
onsecuritypolicyviolation
| ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any)
| null
onseeked
onseeking
onselect
onselectionchange
onselectstart
onslotchange
onstalled
onstorage
onsubmit
onsuspend
ontimeupdate
ontoggle
Optionalontouchcancel
Optionalontouchend
Optionalontouchmove
Optionalontouchstart
ontransitioncancel
ontransitionend
ontransitionrun
ontransitionstart
onunhandledrejection
onunload
onvolumechange
onwaiting
onwebkitanimationend
onwebkitanimationiteration
onwebkitanimationstart
onwebkittransitionend
onwheel
opener
The Window interface's opener property returns a reference to the window that opened the window, either with Window.open, or by navigating a link with a target attribute.
Readonlyorientation
Returns the orientation in degrees (in 90-degree increments) of the viewport relative to the device's natural orientation.
Readonlyorigin
ReadonlyoriginAgentCluster
The originAgentCluster read-only property of the Window interface returns true if this window belongs to an origin-keyed agent cluster: this means that the operating system has provided dedicated resources (for example an operating system process) to this window's origin that are not shared with windows from other origins.
ReadonlyouterHeight
The Window.outerHeight read-only property returns the height in pixels of the whole browser window, including any sidebar, window chrome, and window-resizing borders/handles.
ReadonlyouterWidth
Window.outerWidth read-only property returns the width of the outside of the browser window.
ReadonlypageXOffset
ReadonlypageYOffset
Readonlyparent
The Window.parent property is a reference to the parent of the current window or subframe.
Readonlyperformance
Readonlypersonalbar
Returns the personalbar object.
Readonlyscreen
The Window property screen returns a reference to the screen object associated with the window.
ReadonlyscreenLeft
The Window.screenLeft read-only property returns the horizontal distance, in CSS pixels, from the left border of the user's browser viewport to the left side of the screen.
ReadonlyscreenTop
The Window.screenTop read-only property returns the vertical distance, in CSS pixels, from the top border of the user's browser viewport to the top side of the screen.
ReadonlyscreenX
The Window.screenX read-only property returns the horizontal distance, in CSS pixels, of the left border of the user's browser viewport to the left side of the screen.
ReadonlyscreenY
The Window.screenY read-only property returns the vertical distance, in CSS pixels, of the top border of the user's browser viewport to the top edge of the screen.
Readonlyscrollbars
Returns the scrollbars object.
ReadonlyscrollX
The read-only scrollX property of the Window interface returns the number of pixels by which the document is currently scrolled horizontally.
ReadonlyscrollY
The read-only scrollY property of the Window interface returns the number of pixels by which the document is currently scrolled vertically.
Readonlyself
The Window.self read-only property returns the window itself, as a WindowProxy.
ReadonlysessionStorage
ReadonlyspeechSynthesis
The speechSynthesis read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality.
status
The status property of the bar at the bottom of the browser window.
Readonlystatusbar
Returns the statusbar object.
Readonlytoolbar
Returns the toolbar object.
Readonlytop
Returns a reference to the topmost window in the window hierarchy.
ReadonlyvisualViewport
The visualViewport read-only property of the Window interface returns a VisualViewport object representing the visual viewport for a given window, or null if current document is not fully active.
Readonlywindow
The window property of a Window object points to the window object itself.
Accessors
location
The
Window.locationread-only property returns a Location object with information about the current location of the document.Returns Location
- set location(href: string): void
Parameters
- href: string
Returns void
Methods
addEventListener
- addEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof WindowEventMap
Parameters
- type: K
- listener: (this: Window, ev: WindowEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
alert
window.alert()instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.Parameters
Optionalmessage: any
Returns void
atob
blur
btoa
cancelAnimationFrame
cancelIdleCallback
The
window.cancelIdleCallback()method cancels a callback previously scheduled with window.requestIdleCallback().Parameters
- handle: number
Returns void
captureEvents
clearInterval
clearTimeout
close
The
Window.close()method closes the current window, or the window on which it was called.Returns void
confirm
window.confirm()instructs the browser to display a dialog with an optional message, and to wait until the user either confirms or cancels the dialog.Parameters
Optionalmessage: string
Returns boolean
createImageBitmap
Parameters
- image: ImageBitmapSource
Optionaloptions: ImageBitmapOptions
Returns Promise<ImageBitmap>
- createImageBitmap(
image: ImageBitmapSource,
sx: number,
sy: number,
sw: number,
sh: number,
options?: ImageBitmapOptions,
): Promise<ImageBitmap>Parameters
- image: ImageBitmapSource
- sx: number
- sy: number
- sw: number
- sh: number
Optionaloptions: ImageBitmapOptions
Returns Promise<ImageBitmap>
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
fetch
focus
Makes a request to bring the window to the front.
Returns void
getComputedStyle
The
Window.getComputedStyle()method returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.Parameters
- elt: Element
OptionalpseudoElt: string | null
Returns CSSStyleDeclaration
getSelection
The
getSelection()method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.Returns Selection | null
matchMedia
The Window interface's
matchMedia()method returns a new MediaQueryList object that can then be used to determine if the document matches the media query string, as well as to monitor the document to detect when it matches (or stops matching) that media query.Parameters
- query: string
Returns MediaQueryList
moveBy
The
moveBy()method of the Window interface moves the current window by a specified amount.Parameters
- x: number
- y: number
Returns void
moveTo
The
moveTo()method of the Window interface moves the current window to the specified coordinates.Parameters
- x: number
- y: number
Returns void
open
The
open()method of theWindowinterface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.Parameters
Optionalurl: string | URLOptionaltarget: stringOptionalfeatures: string
Returns Window | null
postMessage
The
window.postMessage()method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.Parameters
- message: any
- targetOrigin: string
Optionaltransfer: Transferable[]
Returns void
Parameters
- message: any
Optionaloptions: WindowPostMessageOptions
Returns void
Opens the print dialog to print the current document.
Returns void
prompt
window.prompt()instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.Parameters
Optionalmessage: stringOptional_default: string
Returns string | null
queueMicrotask
releaseEvents
removeEventListener
- removeEventListener<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends keyof WindowEventMap
Parameters
- type: K
- listener: (this: Window, ev: WindowEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
reportError
requestAnimationFrame
requestIdleCallback
The
window.requestIdleCallback()method queues a function to be called during a browser's idle periods.Parameters
- callback: IdleRequestCallback
Optionaloptions: IdleRequestOptions
Returns number
resizeBy
The
Window.resizeBy()method resizes the current window by a specified amount.Parameters
- x: number
- y: number
Returns void
resizeTo
The
Window.resizeTo()method dynamically resizes the window.Parameters
- width: number
- height: number
Returns void
scroll
The
Window.scroll()method scrolls the window to a particular place in the document.Parameters
Optionaloptions: ScrollToOptions
Returns void
Parameters
- x: number
- y: number
Returns void
scrollBy
The
Window.scrollBy()method scrolls the document in the window by the given amount.Parameters
Optionaloptions: ScrollToOptions
Returns void
Parameters
- x: number
- y: number
Returns void
scrollTo
Window.scrollTo()scrolls to a particular set of coordinates in the document.Parameters
Optionaloptions: ScrollToOptions
Returns void
Parameters
- x: number
- y: number
Returns void
setInterval
Parameters
- handler: TimerHandler
Optionaltimeout: number- ...arguments: any[]
Returns number
setTimeout
Parameters
- handler: TimerHandler
Optionaltimeout: number- ...arguments: any[]
Returns number
stop
The
window.stop()stops further resource loading in the current browsing context, equivalent to the stop button in the browser.Returns void
The
Windowinterface represents a window containing a DOM document; thedocumentproperty points to the DOM document loaded in that window.MDN Reference