Window

The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.

MDN Reference

Properties

Link copied to clipboard

The Window.closed read-only property indicates whether the referenced window is closed or not.

Link copied to clipboard

The cookieStore read-only property of the Window interface returns a reference to the CookieStore object for the current document context.

Link copied to clipboard

The Window.frameElement property returns the element (such as iframe or object) in which the window is embedded.

Link copied to clipboard

Returns the window itself, which is an array-like object, listing the direct sub-frames of the current window.

Link copied to clipboard

The read-only innerHeight property of the including the height of the horizontal scroll bar, if present.

Link copied to clipboard

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).

Link copied to clipboard

The Window.location read-only property returns a Location object with information about the current location of the document.

Link copied to clipboard

Returns the locationbar object.

Link copied to clipboard

Returns the menubar object.

Link copied to clipboard

The Window.name property gets/sets the name of the window's browsing context.

Link copied to clipboard
Link copied to clipboard

Available only in secure contexts.

Link copied to clipboard

Available only in secure contexts.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Available only in secure contexts.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Window.outerWidth read-only property returns the width of the outside of the browser window.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The Window.parent property is a reference to the parent of the current window or subframe.

Link copied to clipboard

Returns the personalbar object.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Returns the scrollbars object.

Link copied to clipboard

The read-only scrollX property of the Window interface returns the number of pixels by which the document is currently scrolled horizontally.

Link copied to clipboard

The read-only scrollY property of the Window interface returns the number of pixels by which the document is currently scrolled vertically.

Link copied to clipboard

Returns the statusbar object.

Link copied to clipboard

Returns the toolbar object.

Link copied to clipboard

Returns a reference to the topmost window in the window hierarchy.

Functions

Link copied to clipboard
fun close()

The Window.close() method closes the current window, or the window on which it was called.

Link copied to clipboard
Link copied to clipboard
fun focus()

Makes a request to bring the window to the front.

Link copied to clipboard
open operator fun get(key: JsString): JsAny?
Link copied to clipboard

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.

Link copied to clipboard
fun moveBy(x: Double, y: Double)

The moveBy() method of the Window interface moves the current window by a specified amount.

Link copied to clipboard
fun moveTo(x: Double, y: Double)

The moveTo() method of the Window interface moves the current window to the specified coordinates.

Link copied to clipboard
fun open(url: String = definedExternally, target: WindowTarget = definedExternally, features: String = definedExternally): WindowProxy?

The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.

fun open(url: URL, target: WindowTarget = definedExternally, features: String = definedExternally): WindowProxy?
Link copied to clipboard
fun postMessage(message: JsAny?, options: WindowPostMessageOptions = definedExternally)

fun postMessage(message: JsAny?, targetOrigin: String, transfer: ReadonlyArray<Transferable> = definedExternally)

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.

Link copied to clipboard
fun print()

Opens the print dialog to print the current document.

Link copied to clipboard
fun resizeBy(x: Double, y: Double)

The Window.resizeBy() method resizes the current window by a specified amount.

Link copied to clipboard
fun resizeTo(width: Int, height: Int)

The Window.resizeTo() method dynamically resizes the window.

Link copied to clipboard
fun scroll(options: ScrollToOptions = definedExternally)

The Window.scroll() method scrolls the window to a particular place in the document.

fun scroll(x: Double, y: Double)
Link copied to clipboard
fun scrollBy(options: ScrollToOptions = definedExternally)

The Window.scrollBy() method scrolls the document in the window by the given amount.

fun scrollBy(x: Double, y: Double)
Link copied to clipboard
fun scrollTo(options: ScrollToOptions = definedExternally)

Window.scrollTo() scrolls to a particular set of coordinates in the document.

fun scrollTo(x: Double, y: Double)
Link copied to clipboard
open operator fun set(key: JsString, value: JsAny?)
Link copied to clipboard
fun stop()

The window.stop() stops further resource loading in the current browsing context, equivalent to the stop button in the browser.

Link copied to clipboard