Window

EventTargetjs.html.Window (extern class)

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

Documentation Window by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Instance Members

window: Window

Returns a reference to the current window.


self: Window

Returns an object reference to the window object itself.


document: HTMLDocument

Returns a reference to the document that the window contains.


name: String

Gets/sets the name of the window.


location: Location

Gets/sets the location, or current URL, of the window object.


history: History

Returns a reference to the history object.


locationbar: BarProp

Returns the locationbar object, whose visibility can be toggled in the window.


Returns the menubar object, whose visibility can be toggled in the window.


personalbar: BarProp

Returns the personalbar object, whose visibility can be toggled in the window.


scrollbars: BarProp

Returns the scrollbars object, whose visibility can be toggled in the window.


statusbar: BarProp

Returns the statusbar object, whose visibility can be toggled in the window.


toolbar: BarProp

Returns the toolbar object, whose visibility can be toggled in the window.


status: String

Gets/sets the text in the statusbar at the bottom of the browser.


closed: Bool

This property indicates whether the current window is closed or not.


event: Dynamic

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.


frames: Window

Returns an array of the subframes in the current window.


length: Int

Returns the number of frames in the window. See also window.frames.


top: Window

Returns a reference to the topmost window in the window hierarchy. This property is read only.


opener: Dynamic

Returns a reference to the window that opened this current window.


parent: Window

Returns a reference to the parent of the current window or subframe.


frameElement: Element

Returns the element in which the window is embedded, or null if the window is not embedded.


Returns a reference to the navigator object.


Returns a reference to the console object which provides access to the browser's debugging console.


screen: Screen

Returns a reference to the screen object associated with the window.


innerWidth: Dynamic

Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.


innerHeight: Dynamic

Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.


scrollX: Float

Returns the number of pixels that the document has already been scrolled horizontally.


pageXOffset: Float

An alias for window.scrollX.


scrollY: Float

Returns the number of pixels that the document has already been scrolled vertically.


pageYOffset: Float

An alias for window.scrollY


screenX: Dynamic

Returns the horizontal distance of the left border of the user's browser from the left side of the screen.


screenY: Dynamic

Returns the vertical distance of the top border of the user's browser from the top side of the screen.


outerWidth: Dynamic

Gets the width of the outside of the browser window.


outerHeight: Dynamic

Gets the height of the outside of the browser window.


performance: Performance

Returns a Performance object, which includes the Performance.timing and Performance.navigation attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.


devicePixelRatio: Float

Returns the ratio between physical pixels and device independent pixels in the current display.


scrollMaxX: Int

The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.


scrollMaxY: Int

The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).


fullScreen: Bool

This property indicates whether the window is displayed in full screen or not.


ondevicemotion: haxe.Function

ondeviceorientation: haxe.Function

onabsolutedeviceorientation: haxe.Function

ondeviceproximity: haxe.Function

onuserproximity: haxe.Function

ondevicelight: haxe.Function

content: Dynamic

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.


orientation: Int

Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.


onorientationchange: haxe.Function

crypto: Crypto

Returns the browser crypto object.





onauxclick: haxe.Function

oncanplay: haxe.Function

oncanplaythrough: haxe.Function

onchange: haxe.Function



oncontextmenu: haxe.Function

ondblclick: haxe.Function


ondragend: haxe.Function

ondragenter: haxe.Function

ondragexit: haxe.Function

ondragleave: haxe.Function

ondragover: haxe.Function

ondragstart: haxe.Function


ondurationchange: haxe.Function

onemptied: haxe.Function



oninvalid: haxe.Function

onkeydown: haxe.Function

onkeypress: haxe.Function



onloadeddata: haxe.Function

onloadedmetadata: haxe.Function

onloadend: haxe.Function

onloadstart: haxe.Function

onmousedown: haxe.Function

onmouseenter: haxe.Function

onmouseleave: haxe.Function

onmousemove: haxe.Function

onmouseout: haxe.Function

onmouseover: haxe.Function

onmouseup: haxe.Function




onplaying: haxe.Function

onprogress: haxe.Function

onratechange: haxe.Function


onresize: haxe.Function

onscroll: haxe.Function

onseeked: haxe.Function

onseeking: haxe.Function

onselect: haxe.Function


onstalled: haxe.Function

onsubmit: haxe.Function

onsuspend: haxe.Function

ontimeupdate: haxe.Function

onvolumechange: haxe.Function

onwaiting: haxe.Function

onselectstart: haxe.Function

ontoggle: haxe.Function

onpointercancel: haxe.Function

onpointerdown: haxe.Function

onpointerup: haxe.Function

onpointermove: haxe.Function

onpointerout: haxe.Function

onpointerover: haxe.Function

onpointerenter: haxe.Function

onpointerleave: haxe.Function

ongotpointercapture: haxe.Function

onlostpointercapture: haxe.Function

onanimationcancel: haxe.Function

onanimationend: haxe.Function

onanimationiteration: haxe.Function

onanimationstart: haxe.Function

ontransitioncancel: haxe.Function

ontransitionend: haxe.Function

ontransitionrun: haxe.Function

ontransitionstart: haxe.Function

onwebkitanimationend: haxe.Function

onwebkitanimationiteration: haxe.Function

onwebkitanimationstart: haxe.Function

onwebkittransitionend: haxe.Function

speechSynthesis: SpeechSynthesis

Returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality.


ontouchstart: haxe.Function

ontouchend: haxe.Function

ontouchmove: haxe.Function

ontouchcancel: haxe.Function

onafterprint: haxe.Function

onbeforeprint: haxe.Function

onhashchange: haxe.Function

onlanguagechange: haxe.Function

onmessage: haxe.Function

onmessageerror: haxe.Function

onoffline: haxe.Function

ononline: haxe.Function

onpagehide: haxe.Function

onpageshow: haxe.Function

onpopstate: haxe.Function

onstorage: haxe.Function

onunload: haxe.Function

localStorage: Storage

Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.


origin: String

isSecureContext: Bool

Indicates whether a context is capable of using features that require secure contexts.




sessionStorage: Storage

Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.


Name Type
`` haxe.extern.EitherType<Event, String>
`` String
`` Int
`` Int
`` Dynamic
Returns
Dynamic

onbeforeunload(): Null<String>
Returns
Null<String>

close(): Void

Closes the current window.


stop(): Void

This method stops window loading.


focus(): Void

Sets focus on the current window.


blur(): Void

Sets focus away from the window.


open(?url: String = "", ?target: String = "", ?features: String = ""): Window

Opens a new window.

Name Type Default
url String ""
target String ""
features String ""
Returns
Window

alert(message: String): Void

Displays an alert dialog.

Name Type
message String

confirm(?message: String = ""): Bool

Displays a dialog with a message that the user needs to respond to.

Name Type Default
message String ""
Returns
Bool

prompt(?message: String = "", ?default_: String = ""): String

Returns the text entered by the user in a prompt dialog.

Name Type Default
message String ""
default_ String ""
Returns
String

print(): Void

Opens the Print Dialog to print the current document.


postMessage(message: Dynamic, targetOrigin: String, ?transfer: Array<Dynamic>): Void

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.

Name Type Default
message Dynamic
targetOrigin String
transfer Array<Dynamic> (optional)

captureEvents(): Void

Registers the window to capture all events of the specified type.


releaseEvents(): Void

Releases the window from trapping events of a specific type.


getSelection(): Selection

Returns the selection object representing the selected item(s).

Returns
Selection

getComputedStyle(elt: Element, ?pseudoElt: String = ""): CSSStyleDeclaration

Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.

Name Type Default
elt Element
pseudoElt String ""
Returns
CSSStyleDeclaration

matchMedia(query: String): MediaQueryList

Returns a MediaQueryList object representing the specified media query string.

Name Type
query String
Returns
MediaQueryList

moveTo(x: Int, y: Int): Void

Moves the window to the specified coordinates.

Name Type
x Int
y Int

moveBy(x: Int, y: Int): Void

Moves the current window by a specified amount.

Name Type
x Int
y Int

resizeTo(x: Int, y: Int): Void

Dynamically resizes window.

Name Type
x Int
y Int

resizeBy(x: Int, y: Int): Void

Resizes the current window by a certain amount.

Name Type
x Int
y Int

scroll(?options: Null<ScrollToOptions>): Void

Scrolls the window to a particular place in the document.

Name Type Default
options Null<ScrollToOptions> (optional)

scrollTo(?options: Null<ScrollToOptions>): Void

Scrolls to a particular set of coordinates in the document.

Name Type Default
options Null<ScrollToOptions> (optional)

scrollBy(?options: Null<ScrollToOptions>): Void

Scrolls the document in the window by the given amount.

Name Type Default
options Null<ScrollToOptions> (optional)

requestAnimationFrame(callback: Function): Int

Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.

Name Type
callback Function
Returns
Int

cancelAnimationFrame(handle: Int): Void

Enables you to cancel a callback previously scheduled with Window.requestAnimationFrame.

Name Type
handle Int

getDefaultComputedStyle(elt: Element, ?pseudoElt: String = ""): CSSStyleDeclaration

Gets default computed style for the specified element, ignoring author stylesheets.

Name Type Default
elt Element
pseudoElt String ""
Returns
CSSStyleDeclaration

scrollByLines(numLines: Int, ?options: Null<ScrollOptions>): Void

Scrolls the document by the given number of lines.

Name Type Default
numLines Int
options Null<ScrollOptions> (optional)

scrollByPages(numPages: Int, ?options: Null<ScrollOptions>): Void

Scrolls the current document by the specified number of pages.

Name Type Default
numPages Int
options Null<ScrollOptions> (optional)

sizeToContent(): Void

Sizes the window according to its content.


updateCommands(action: String, ?sel: Selection, ?reason: Int = 0): Void

Updates the state of commands of the current chrome window (UI).

Name Type Default
action String
sel Selection (optional)
reason Int 0

find(?str: String = "", ?caseSensitive: Bool = false, ?backwards: Bool = false, ?wrapAround: Bool = false, ?wholeWord: Bool = false, ?searchInFrames: Bool = false, ?showDialog: Bool = false): Bool

Searches for a given string in a window.

Name Type Default
str String ""
caseSensitive Bool false
backwards Bool false
wrapAround Bool false
wholeWord Bool false
searchInFrames Bool false
showDialog Bool false
Returns
Bool

dump(str: String): Void

Writes a message to the console.

Name Type
str String

structuredClone(value: structuredClone.T, ?options: AnonStruct): structuredClone.T

Creates a deep clone of a given value using the structured clone algorithm.

Name Type Default
value structuredClone.T
options AnonStruct (optional)
Returns
structuredClone.T

setResizable(resizable: Bool): Void

Toggles a user's ability to resize a window.

Name Type
resizable Bool

btoa(btoa: String): String
Name Type
btoa String
Returns
String

atob(atob: String): String
Name Type
atob String
Returns
String

setTimeout(handler: String, ?timeout: Float = 0, unused: haxe.extern.Rest): Int
Name Type Default
handler String
timeout Float 0
unused haxe.extern.Rest
Returns
Int

clearTimeout(?handle: Int = 0): Void
Name Type Default
handle Int 0

setInterval(handler: String, ?timeout: Float = 0, unused: haxe.extern.Rest): Int
Name Type Default
handler String
timeout Float 0
unused haxe.extern.Rest
Returns
Int

clearInterval(?handle: Int = 0): Void
Name Type Default
handle Int 0

createImageBitmap(aImage: ImageElement, aOffset: Int, aLength: Int, aFormat: ImageBitmapFormat, aLayout: Array<ChannelPixelLayout>): js.lib.Promise<ImageBitmap>
Name Type
aImage ImageElement
aOffset Int
aLength Int
aFormat ImageBitmapFormat
aLayout Array<ChannelPixelLayout>
Returns
js.lib.Promise<ImageBitmap>

Name Type Default
input Request
init Null<RequestInit> (optional)
Returns
js.lib.Promise<Response>