Window : Global Window is the global object in the browser that represents the browser window for the page. The window object itself is available through the %%#window|**window**%% property and all properties on the Window are available directly in scripts. The Window object is also available as **this** in the root scope of a script (ie, outside of any %%/Function|Function%%). Spec: https://html.spec.whatwg.org/#the-window-object ---- instance.frameElement : Element ReadOnly: true ---- instance.frames : Window ReadOnly: true ---- instance.length : Number ReadOnly: true ---- instance.opener : Window ---- instance.pageXOffset : Number ReadOnly: true Spec: https://drafts.csswg.org/cssom-view-1/#dom-window-pagexoffset ---- instance.pageYOffset : Number ReadOnly: true Spec: https://drafts.csswg.org/cssom-view-1/#dom-window-pageyoffset ---- instance.parent : Window ReadOnly: true ---- instance.scrollX : Number ReadOnly: true Spec: https://drafts.csswg.org/cssom-view-1/#dom-window-scrollx ---- instance.scrollY : Number ReadOnly: true Spec: https://drafts.csswg.org/cssom-view-1/#dom-window-scrolly ---- instance.top : Window ReadOnly: true ---- instance.globalThis : Window Returns the global object for the browser. Also available through the %%#window|**window**%% property, %%#self|**self**%% property, and **this** in the root scope. ReadOnly: true Version: ECMAScript 2020 ---- instance.window : Window Returns the global object for the browser. Also available through the %%#self|**self**%% property, through **this** in the root scope, and through the %%#globalThis|**globalThis**%% property (in ECMAScript 2020). ReadOnly: true Spec: https://html.spec.whatwg.org/#dom-window ---- instance.self : Window Returns the global object for the browser. Also available through the %%#window|**window**%% property and through **this** in the root scope. ReadOnly: true Spec: https://html.spec.whatwg.org/#dom-self ---- instance.crypto : Crypto Spec: http://www.w3.org/TR/WebCryptoAPI/#dfn-Crypto ---- instance.customElements : CustomElementRegistry Provides a way to extend HTML/DOM with your own elements that have custom logic similar to built in elements. See also %%/CustomElementPrototype|CustomElementPrototype%%. MyElement from HTML ReadOnly: true Spec: https://html.spec.whatwg.org/multipage/custom-elements.html ---- instance.document : Document Returns the document for this window.
Hello World
ReadOnly: true Spec: https://html.spec.whatwg.org/#dom-document-2 ---- instance.name : String Spec: https://html.spec.whatwg.org/#dom-name ---- instance.location : Location Describes the url of the current page. See %%/Location|Location%% for more details. ReadOnly: true Spec: https://html.spec.whatwg.org/#dom-location ---- instance.history : History Represents the user's browser history and allows the page to manipulate the history by adding pages or navigating between pages. See %%/History|History%% for more details.



history.state =
history.length =
href =
ReadOnly: true Spec: https://html.spec.whatwg.org/#dom-history ---- instance.status : String ---- instance.localStorage : Storage **localStorage** allows saving data in the web browser that can be retrieved in future views of the web page. The data is saved across browser sessions and computer reboots. See also %%#sessionStorage|**sessionStorage**%% and %%/Storage|Storage%% for more details.
ReadOnly: true ---- instance.sessionStorage : Storage **sessionStorage** allows saving data in the web browser that can be retrieved in future views of the web page. The data is only saved for the current session, that is until the user closes the web browser. See also %%#localStorage|**localStorage**%% and %%/Storage|Storage%% for more details.
ReadOnly: true ---- instance.navigator : Navigator ---- instance.external : External ReadOnly: true ---- instance.applicationCache : ApplicationCache ReadOnly: true ---- instance.indexedDB : IDBFactory ---- instance.innerWidth : Number Width of the browser window in CSS pixels exluding any browser chrome. console.log(window.innerWidth); console.log(window.outerWidth); console.log(screen.availWidth); console.log(screen.width); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-innerwidth ---- instance.innerHeight : Number Height of the browser window in CSS pixels excluding any browser chrome. console.log(window.innerHeight); console.log(window.outerHeight); console.log(screen.availHeight); console.log(screen.height); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-outerheight ---- instance.outerWidth : Number Width of the browser window in CSS pixels including any browser chrome. console.log(window.outerWidth); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-outerwidth ---- instance.outerHeight : Number Height of the browser window in CSS pixels including any browser chrome. console.log(window.outerHeight); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-outerheight ---- instance.screen : Screen ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-screen ---- instance.screenX : Number X position of the top left corner of the browser in pixels. See %%/Screen|screen%% for details about the size of the screen. console.log(window.screenX); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-screenx ---- instance.screenY : Number Y position of the top left corner of the browser in pixels. See %%/Screen|screen%% for details about the size of the screen. console.log(window.screenY); ReadOnly: true Spec: https://drafts.csswg.org/cssom-view/#dom-window-screeny ---- prototype.btoa(encoded : String) : String Converts a unicode/binary string into an ascii encoded string (%%http://en.wikipedia.org/wiki/Base64|base64%%). See also %%#atob|**atob()**%%. Spec: https://html.spec.whatwg.org/#dom-windowbase64-btoa ---- prototype.atob(unencoded : String) : String Converts an ascii encoded string (%%http://en.wikipedia.org/wiki/Base64|base64%%) into a unicode/binary string. See also %%#btob|**btob()**%%. Spec: https://html.spec.whatwg.org/#dom-windowbase64-atob ---- prototype.setTimeout(callback : Function, [timeout = 0: Number, [...]]) : Number Schedules **callback** to be called once after **timeout** milliseconds. Any extra parameters after **timeout** are passed to **callback**. Returns a unique handle that can be passed to %%#clearTimeout|**clearTimeout()**%% to stop **callback** from being called. See also %%#setInterval|**setInterval()**%% and %%#requestAnimationFrame|**requestAnimationFrame()**%%. Spec: https://html.spec.whatwg.org/#dom-windowtimers-settimeout ---- prototype.setTimeout(callback : String, [timeout = 0: Number, [...]]) : Number Same as %%#setTimeout_Function_Number_dotdotdot|setTimeout()%% where the **callback** string is passed to %%/Global#eval|eval%% when the time has elapsed. Spec: https://html.spec.whatwg.org/#dom-windowtimers-settimeout ---- prototype.clearTimeout(handle : Number) : undefined Stops a timeout from running. **handle** is the value returned by %%#setTimeout|**setTimeout()**%%. ---- prototype.createImageBitmap(source : HTMLImageElement) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLImageElement, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLImageElement, sx : Number, sy : Number, sw : Number, sh : Number) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLImageElement, \ sx : Number, sy : Number, sw : Number, sh : Number, \ [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLVideoElement) : Promise
Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLVideoElement, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise
Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLCanvasElement) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : HTMLCanvasElement, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : Blob) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : Blob, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : ImageData) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : ImageData, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.createImageBitmap(source : ImageBitmap, [options : { \ imageOrientation : String /* One of **'none'** or **'flipY'**. Default is **'none'**. */, \ premultiplyAlpha : String /* One of **'none'**, **'premultiply'**, or **'default'**. Default is **'default'**. */, \ colorSpaceConversion : String /* One of **'none'** or **'default'**. Default is **'default'**. */, \ resizeWidth : Number, \ resizeHeight : Number, \ resizeQuality : String /* One of **'pixelated'**, **'low'**, **'medium'**, or **'high'**. Default is **'low'**. */ \ }]) : Promise Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap ---- prototype.requestAnimationFrame(callback(time : Number) : undefined) : Number Schedules **callback** to be called before the next time the browser renders a frame to the screen. Must be called each time you'd like to schedule another frame. The **time** parameter to callback is the number of milliseconds since the page loaded. Returns a unique handle that can be passed to %%#cancelAnimationFrame|**cancelAnimationFrame()**%% to stop **callback** from being called.
---- prototype.cancelAnimationFrame(handle : Number) : undefined Stops an animation frame callback from running. **handle** is the value returned by %%#requestAnimationFrame|**requestAnimationFrame()**%%. ---- prototype.setInterval(callback : Function, [timeout : Number, [...]]) : Number Schedules **callback** to be called repeatedly, every **timeout** milliseconds. Any extra parameters after **timeout** are passed to **callback**. Returns a unique handle that can be passed to %%#clearInterval|**clearInterval()**%% to stop **callback** from being called. See also %%#setTimeout|**setTimeout()**%% and %%#requestAnimationFrame|**requestAnimationFrame()**%%. ---- prototype.setInterval(callback : String, [timeout : Number, [...]]) : Number Same as %%#setInterval_Function_Number_dotdotdot|setInterval()%% where the **callback** string is passed to %%/Global#eval|eval%% when the time has elapsed. ---- prototype.clearInterval(handle : Number) : undefined Stops an %%#setInterval|**setInterval()**%% callback from running. **handle** is the value returned by **setInterval()**. ---- prototype.blur() : undefined ---- prototype.close() : undefined ---- prototype.fetch(url : String, [requestInit : Object]) : Promise Fetches the specified url. See also %%/Request|Request%% and %%/Response|Response%%. Spec: https://fetch.spec.whatwg.org/#dom-global-fetch ---- prototype.fetch(request : Request, [requestInit : Object]) : Promise Fetches the specified web request. If **requestInit** is specified, its values overwrite the values on **request**. See also %%/Request|Request%% and %%/Response|Response%%. Spec: https://fetch.spec.whatwg.org/#dom-global-fetch ---- prototype.focus() : undefined ---- prototype.stop() : undefined ---- prototype.open([url : String, [target = '_blank' : String, [features : String, [replace : Boolean]]]]) : Window Opens a new tab or window for the specified **url**.
**url**
the url to open or **''** to open an empty window.
**target**
must be one of:
**'_blank'**
open in new window, the default
**'_parent'**
open in parent page/frame
**'_self'**
open in current page/frame
**'_top'**
open in top page
**'<name>'**
open in the window with the specified name
**features**
is a comma separated list of **'<name>=<value>'** pairs where the valid names are **'left'**, **'top'**, **'height'**, **'width'**.
**replace**
pass **true** to replace the contents instead of opening a new window.
---- prototype.alert(message : String) : undefined Displays a message box to the user with the specified message. Script execution is paused while the message box is displayed. See also %%#confirm|**confirm()**%% and %%#prompt|**prompt()**%%. ---- prototype.confirm(message : String) : Boolean Displays an Ok/Cancel message box to the user with the specified message. Returns **true** if the user clicked Ok. Script execution is paused while the message box is displayed. See also %%#alert|**alert()**%% and %%#prompt|**prompt()**%%. ---- prototype.matchMedia(query : String) : MediaQueryList Spec: https://drafts.csswg.org/cssom-view/#dom-window-matchmedia ---- prototype.prompt(message : String, [default : String]) : String Displays a message box containing an input box to the user with the specified message. The input box will be prepopulated with **default** if it is specified. Returns the String the user typed in the input box if the user clicks ok and **null** if they click cancel. Script execution is paused while the message box is displayed. See also %%#alert|**alert()**%% and %%#confirm|**confirm()**%%. ---- prototype.print() : undefined ---- prototype.showModalDialog(url : String, [arguments : Object]) : Object ---- prototype.getComputedStyle(element : Element, [pseudoElement : String]) : CSSStyleDeclaration Computes the effective style for **element** including all CSS rules that apply to **element**. See also %%/HTMLElement#style|**element.style**%%. foo Spec: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSview-getComputedStyle ---- prototype.postMessage(message : Object, expectedOrigin : String, [transfer : Array]) : undefined

Sends **message** to **this** (usually something other than the global %%/Global#window|**window**%%, like the %%#parent|**parent**%%, iframe %%/HTMLIFrameElement#contentWindow|**contentwindow**%%, or return value of %%#open|**open()**%%). The **message** will be available in the %%/MessageEvent#data|**MessageEvent.data**%% property on the event passed to the %%#message|onmessage%% event listener. To ensure the window's content has not changed while the message is in flight, **expectedOrigin** must match %%/Location#origin|**this.origin**%% (or be **'*'** to ignore check and possibly send the message to another site). The elements of **objectsToTransfer** will be transferred to the JavaScript context that owns **this** and no longer available in the context that called **postMessage()**.

See also %%/MessageChannel|MessageChannel%%.

---- event.abort : listener(event : Event) : undefined ---- event.afterprint : listener(event : Event) : undefined ---- event.beforeprint : listener(event : Event) : undefined ---- event.beforeunload : listener(event : BeforeUnloadEvent) : String Called before the page is navigated away from. Return a non-empty String from **listener** to display a dialog box that gives the user the option to remain on the current page.
http://
---- event.blur : listener(event : Event) : undefined ---- event.canplay : listener(event : Event) : undefined ---- event.canplaythrough : listener(event : Event) : undefined ---- event.change : listener(event : Event) : undefined ---- event.click : listener(event : Event) : undefined ---- event.contextmenu : listener(event : Event) : undefined ---- event.cuechange : listener(event : Event) : undefined ---- event.dblclick : listener(event : Event) : undefined ---- event.drag : listener(event : Event) : undefined ---- event.dragend : listener(event : Event) : undefined ---- event.dragenter : listener(event : Event) : undefined ---- event.dragleave : listener(event : Event) : undefined ---- event.dragover : listener(event : Event) : undefined ---- event.dragstart : listener(event : Event) : undefined ---- event.drop : listener(event : Event) : undefined ---- event.durationchange : listener(event : Event) : undefined ---- event.emptied : listener(event : Event) : undefined ---- event.ended : listener(event : Event) : undefined ---- event.error : listener(event : Event, source : String, line : Number, column : Number) : undefined ---- event.focus : listener(event : Event) : undefined ---- event.hashchange : listener(event : HashChangeEvent) : undefined Fired when the **'#'** portion of the url changes. See also %%/Location#hash|**location.hash**%%. Go to #bar
Go to #foo
---- event.input : listener(event : Event) : undefined ---- event.invalid : listener(event : Event) : undefined ---- event.keydown : listener(event : Event) : undefined ---- event.keypress : listener(event : Event) : undefined ---- event.keyup : listener(event : Event) : undefined ---- event.load : listener(event : Event) : undefined ---- event.loadeddata : listener(event : Event) : undefined ---- event.loadedmetadata : listener(event : Event) : undefined ---- event.loadstart : listener(event : Event) : undefined ---- event.message : listener(event : Event) : undefined Fired when %%#postMessage|**postMessage()**%% is called on **this**. ---- event.mousedown : listener(event : Event) : undefined ---- event.mousemove : listener(event : Event) : undefined ---- event.mouseout : listener(event : Event) : undefined ---- event.mouseover : listener(event : Event) : undefined ---- event.mouseup : listener(event : Event) : undefined ---- event.mousewheel : listener(event : Event) : undefined ---- event.offline : listener(event : Event) : undefined ---- event.online : listener(event : Event) : undefined ---- event.pause : listener(event : Event) : undefined ---- event.play : listener(event : Event) : undefined ---- event.playing : listener(event : Event) : undefined ---- event.pagehide : listener(event : Event) : undefined ---- event.pageshow : listener(event : Event) : undefined ---- event.popstate : listener(event : PopStateEvent) : undefined Called when the page navigation changes. See also %%/History|History%%. Spec: https://html.spec.whatwg.org/#handler-window-onpopstate ---- event.progress : listener(event : Event) : undefined ---- event.ratechange : listener(event : Event) : undefined ---- event.reset : listener(event : Event) : undefined ---- event.resize : listener(event : Event) : undefined ---- event.scroll : listener(event : Event) : undefined ---- event.seeked : listener(event : Event) : undefined ---- event.seeking : listener(event : Event) : undefined ---- event.select : listener(event : Event) : undefined ---- event.show : listener(event : Event) : undefined ---- event.stalled : listener(event : Event) : undefined ---- event.submit : listener(event : Event) : undefined ---- event.suspend : listener(event : Event) : undefined ---- event.timeupdate : listener(event : Event) : undefined ---- event.unload : listener(event : Event) : undefined ---- event.volumechange : listener(event : Event) : undefined ---- event.storage : listener(event : StorageEvent) : undefined ---- event.unhandledrejection : listener(event : PromiseRejectionEvent) : undefined Fired when a %%/Promise|Promise%%'s reject handler is called or an exception is thrown in an Promise executor function or in an async function. ---- event.copy : listener(event : ClipboardEvent) : undefined Bubbles: true Cancelable: true Spec: https://w3c.github.io/clipboard-apis/#clipboard-event-copy ---- event.cut : listener(event : ClipboardEvent) : undefined Bubbles: true Cancelable: true Spec: https://w3c.github.io/clipboard-apis/#clipboard-event-cut ---- event.paste : listener(event : ClipboardEvent) : undefined Bubbles: true Cancelable: true Spec: https://w3c.github.io/clipboard-apis/#clipboard-event-paste ---- event.gamepadconnected : listener(event : GamepadEvent) : undefined Press button on controller to connect. Spec: https://w3c.github.io/gamepad/#event-gamepadconnected ---- event.gamepaddisconnected : listener(event : GamepadEvent) : undefined Press button on controller to connect. Spec: https://w3c.github.io/gamepad/#event-gamepaddisconnected