class js.html.DOMWindow extends EventTarget

Available on js

This section provides a brief reference for all of the methods, properties, and events available through the DOM window object. The window object implements the Window interface, which in turn inherits from the AbstractView interface. Some additional global functions, namespaces objects, and constructors, not typically associated with the window, but available on it, are listed in the JavaScript Reference.

The window object represents the window itself. The document property of a window points to the DOM document loaded in that window. A window for a given document can be obtained using the document.defaultView property.

In a tabbed browser, such as Firefox, each tab contains its own window object (and if you're writing an extension, the browser window itself is a separate window too - see Working with windows in chrome code for more information). That is, the window object is not shared between tabs in the same window. Some methods, namely window.resizeTo and window.resizeBy apply to the whole window and not to the specific tab the window object belongs to. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.



Documentation for this class was provided by MDN.

Class Fields

static var PERSISTENT:Int

static var TEMPORARY:Int

Instance Fields

var applicationCache:DOMApplicationCache

An nsIDOMOfflineResourceList object providing access to the offline resources for the window.

var closed:Bool

This property indicates whether the current window is closed or not.
window.Components
The entry point to many XPCOM features. Some properties, e.g. classes, are only available to sufficiently privileged code.

var crypto:Crypto

Returns the browser crypto object.

var defaultStatus:String

Gets/sets the status bar text for the given window.

var document:Document

Returns a reference to the document that the window contains.

var frameElement:Element

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

var frames:DOMWindow

Returns an array of the subframes in the current window.

var history:History

Returns a reference to the history object.

var innerHeight:Int

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

var innerWidth:Int

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

var length:Int

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

var 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. Getter throws DOMException.

var location:Location

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

var locationbar:BarInfo

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

var menubar:BarInfo

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

var name:String

Gets/sets the name of the window.

var navigator:Navigator

Returns a reference to the navigator object.

var onabort:EventListener

An event handler property for abort events on the window.

var onbeforeunload:EventListener

An event handler property for before-unload events on the window.

var onblur:EventListener

An event handler property for blur events on the window.

var onchange:EventListener

An event handler property for change events on the window.

var onclick:EventListener

An event handler property for click events on the window.

var oncontextmenu:EventListener

An event handler property for right-click events on the window.

var onerror:EventListener

An event handler property for errors raised on the window.

var onfocus:EventListener

An event handler property for focus events on the window.

var onhashchange:EventListener

An event handler property for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.

var onkeydown:EventListener

An event handler property for keydown events on the window.

var onkeypress:EventListener

An event handler property for keypress events on the window.

var onkeyup:EventListener

An event handler property for keyup events on the window.

var onload:EventListener

An event handler property for window loading.

var onmousedown:EventListener

An event handler property for mousedown events on the window.

var onmousemove:EventListener

An event handler property for mousemove events on the window.

var onmouseout:EventListener

An event handler property for mouseout events on the window.

var onmouseover:EventListener

An event handler property for mouseover events on the window.

var onmouseup:EventListener

An event handler property for mouseup events on the window.

var onpagehide:EventListener

An event handler property for pagehide events on the window.

var onpageshow:EventListener

An event handler property for pageshow events on the window.

var onpopstate:EventListener

An event handler property for popstate events, which are fired when navigating to a session history entry representing a state object.

var onreset:EventListener

An event handler property for reset events on the window.

var onresize:EventListener

An event handler property for window resizing.

var onscroll:EventListener

An event handler property for window scrolling.

var onselect:EventListener

An event handler property for window selection.

var onsubmit:EventListener

An event handler property for submits on window forms.

var onunload:EventListener

An event handler property for unload events on the window.

var opener:DOMWindow

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

var outerHeight:Int

Gets the height of the outside of the browser window.

var outerWidth:Int

Gets the width of the outside of the browser window.

var pageXOffset:Int

An alias for window.scrollX .

var parent:DOMWindow

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

var personalbar:BarInfo

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

var screen:Screen

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

var screenX:Int

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

var screenY:Int

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

var scrollX:Int

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

var scrollY:Int

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

var scrollbars:BarInfo

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

var self:DOMWindow

Returns an object reference to the window object itself.

var sessionStorage:Storage

A storage object for storing data within a single page session. Getter throws DOMException.

var status:String

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

var statusbar:BarInfo

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

var toolbar:BarInfo

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

var top:DOMWindow

Returns a reference to the topmost window in the window hierarchy. This property is read only.
window.URLRequires Gecko 2.0
A DOM URL object, which provides the window.URL.createObjectURL() and window.URL.revokeObjectURL() methods.

var window:DOMWindow

Returns a reference to the current window.
window[0], window[1], etc.
Returns a reference to the window object in the frames. See window.frames for more details.

function alert(message:String):Void

function atob(?string:String):String

function blur():Void

function btoa(?string:String):String

function captureEvents():Void

function clearInterval(handle:Int):Void

function clearTimeout(handle:Int):Void

function close():Void

function confirm(message:String):Bool

function find(string:String, caseSensitive:Bool, backwards:Bool, wrap:Bool, wholeWord:Bool, searchInFrames:Bool, showDialog:Bool):Bool

function focus():Void

function getComputedStyle(element:Element, ?pseudoElement:String):CSSStyleDeclaration

function getMatchedCSSRules(element:Element, ?pseudoElement:String):CSSRuleList

function moveBy(x:Float, y:Float):Void

function moveTo(x:Float, y:Float):Void

function open(url:String, name:String, ?options:String):DOMWindow

function openDatabase(name:String, version:String, displayName:String, estimatedSize:Int, ?creationCallback:DatabaseCallback):Database

function postMessage(message:Dynamic, targetOrigin:String, messagePorts:Array<Dynamic>):Void

function postMessage(message:Dynamic, targetOrigin:String):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, in a secure manner. Throws DOMException.

function print():Void

function prompt(message:String, ?defaultValue:String):String

function releaseEvents():Void

function requestFileSystem(type:Int, size:Int, successCallback:FileSystemCallback, ?errorCallback:ErrorCallback):Void

function resizeBy(x:Float, y:Float):Void

function resizeTo(width:Float, height:Float):Void

function resolveLocalFileSystemURL(url:String, successCallback:EntryCallback, ?errorCallback:ErrorCallback):Void

function scroll(x:Int, y:Int):Void

function scrollBy(x:Int, y:Int):Void

function scrollTo(x:Int, y:Int):Void

function setInterval(handler:Void, timeout:Int):Int

function setTimeout(handler:Void, timeout:Int):Int

function showModalDialog(url:String, ?dialogArgs:Dynamic, ?featureArgs:String):Dynamic

function stop():Void