| Package | dom |
| Class | public class Window |
| Inheritance | Window Object |
| Implements | ViewCSS, AbstractView, WindowView, EventTarget |
| Subclasses | WindowProxy |
| Property | Defined By | ||
|---|---|---|---|
| applicationCache : nsIDOMOfflineResourceList [read-only]
Non-Standard | Firefox 3+
Returns a reference to the application cache object for the window. | Window | ||
| closed : Boolean [read-only]
DOM Level 0
This property indicates whether the referenced window is closed or not. | Window | ||
| Components : nsIXPCComponents [read-only]
Non-Standard | Firefox
The Components object is the object through which XPConnect functionality is reflected into JavaScript. | Window | ||
| content : Window [read-only]
Non-Standard | Firefox
Returns a Window object for the primary content window. | Window | ||
| crypto : Crypto [read-only]
DOM Level 0
Returns the browser crypto object, which can then be used to manipulate various
browser security features. | Window | ||
| defaultStatus : DOMString
DOM Level 0
Gets/sets the status bar text for the given window. | Window | ||
| directories : BarProp [read-only]
DOM Level 0
Returns the window directories toolbar object. | Window | ||
| document : DocumentView [read-only]
The source DocumentView of which this is an AbstractView. | Window | ||
| frameElement : Element [read-only]
DOM Level 0
Returns the element (such as <iframe> or <object>) in which the window is embedded,
or null if the window is top-level. | Window | ||
| frames : Array [read-only]
DOM Level 0
Returns an array-like object, listing the direct sub-frames of the current window. | Window | ||
| fullScreen : Boolean
DOM Level 0 | Firefox 3+
This property indicates whether the window is displayed in full screen mode or not. | Window | ||
| globalStorage : Object [read-only]
Non-Standard | Firefox 2
This is a global object (globalStorage) that maintains multiple private storage areas
that can be used to hold data over a long period of time (e.g. | Window | ||
| history : History [read-only]
DOM Level 0
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). | Window | ||
| HTML 5 innerHeight : Number [read-only]
Height of the browser window viewport including, if rendered, the horizontal scrollbar. | Window | ||
| HTML 5 innerWidth : Number [read-only]
Width of the browser window viewport including, if rendered, the vertical scrollbar. | Window | ||
| length : Number [read-only]
DOM Level 0
Returns the number of frames (either frame or iframe elements) in the window. | Window | ||
| localStorage : Storage [read-only]
Web Storage
This is a global object that maintains multiple private storage areas
that can be used to hold data over a long period of time (e.g. | Window | ||
| location : Location [read-only]
DOM Level 0
Returns a Location object, which contains information about the URL
of the document and provides methods for changing that URL. | Window | ||
| locationbar : BarProp [read-only]
DOM Level 0
Returns the locationbar object, whose visibility can be toggled in the window. | Window | ||
| HTML 5 media : Media [read-only]
Returns an Media object. | Window | ||
| menubar : BarProp [read-only]
DOM Level 0
Returns the menubar object, whose visibility can be toggled in the window. | Window | ||
| name : DOMString
DOM Level 0
Gets/sets the name of the window. | Window | ||
| navigator : Navigator [read-only]
DOM Level 0
Returns a reference to the navigator object, which can be queried for information
about the application running the script. | Window | ||
| onabort : Function
An event handler for abort events sent to the window. | Window | ||
| onbeforeunload : Function
An event that fires before the unload event when the page is unloaded. | Window | ||
| onblur : Function
DOM Level 0
The onblur property can be used to set the blur handler on the window, which is triggered when the window loses focus. | Window | ||
| onchange : Function
An event handler for change events sent to the window. | Window | ||
| onclick : Function
Called when the user clicks the mouse button while the cursor is in the window. | Window | ||
| onclose : Function
An event handler for close events sent to the window. | Window | ||
| oncontextmenu : Function
An event handler property for right-click events on the window. | Window | ||
| ondragdrop : Function
An event handler for drag and drop events sent to the window. | Window | ||
| onerror : Function
An event handler for error events sent to the window. | Window | ||
| onfocus : Function
An event handler for focus events sent to the window. | Window | ||
| onkeydown : Function
An event handler for the keydown event on the window. | Window | ||
| onkeypress : Function
An event handler for the keypress event on the window. | Window | ||
| onkeyup : Function
An event handler for the keyup event on the window. | Window | ||
| onload : Function
DOM Level 0
An event handler for the load event of a window. | Window | ||
| onmousedown : Function
An event handler for the mousedown event on the window. | Window | ||
| onmousemove : Function
An event handler for the mousemove event on the window. | Window | ||
| onmouseout : Function
An event handler for the mouseout event on the window. | Window | ||
| onmouseover : Function
An event handler for the mouseover event on the window. | Window | ||
| onmouseup : Function
An event handler for the mouseup event on the window. | Window | ||
| onpaint : Function
DOM Level 0
An event handler for the paint event on the window. | Window | ||
| onreset : Function
An event handler for the reset event on the window. | Window | ||
| onresize : Function
An event handler for the resize event on the window. | Window | ||
| onscroll : Function
Specifies the function to be called when the window is scrolled. | Window | ||
| onselect : Function
An event handler for the select event on the window. | Window | ||
| onsubmit : Function
An event handler for the submit event on the window. | Window | ||
| onunload : Function
DOM Level 0
The unload event is raised when the document is unloaded. | Window | ||
| opener : WindowProxy [read-only]
DOM Level 0
Returns a reference to the window that opened this current window. | Window | ||
| HTML 5 outerHeight : Number [read-only]
Gets the height of the outside of the browser window. | Window | ||
| HTML 5 outerWidth : Number [read-only]
Gets the width of the outside of the browser window. | Window | ||
| HTML 5 pageXOffset : Number [read-only]
Returns the number of pixels that the document has already been scrolled horizontally. | Window | ||
| HTML 5 pageYOffset : Number [read-only]
Returns the number of CSS pixels the user has scrolled towards the bottom within the viewport. | Window | ||
| parent : Window [read-only]
DOM Level 0
Returns a reference to the parent of the current window or subframe. | Window | ||
| personalbar : BarProp [read-only]
Returns the personalbar object, whose visibility can be toggled in the window. | Window | ||
| pkcs11 : Pkcs11 [read-only]
DOM Level 0
Returns the pkcs11 object , which can be used to install drivers and other software
associated with the pkcs11 protocol. | Window | ||
| returnValue : * [read-only]
Non-Standard? | Firefox 3+
The return value to be returned to the function that called window.showModalDialog()
to display the window as a modal dialog. | Window | ||
| HTML 5 screen : Screen [read-only]
Returns a reference to the screen object associated with the window. | Window | ||
| HTML 5 screenX : Number [read-only]
Returns the horizontal distance of the left border of the user's browser from the left side of the screen. | Window | ||
| HTML 5 screenY : Number [read-only]
Returns the vertical distance of the top border of the user's browser from the top edge of the screen. | Window | ||
| scrollbars : BarProp [read-only]
DOM Level 0
Returns the scrollbars object, whose visibility can be toggled in the window. | Window | ||
| scrollMaxX : Number [read-only]
DOM Level 0
Returns the maximum number of pixels that the document can be scrolled horizontally. | Window | ||
| scrollMaxY : Number [read-only]
DOM Level 0
Returns the maximum number of pixels that the document can be scrolled vertically. | Window | ||
| scrollX : Number [read-only]
DOM Level 0
Returns the number of pixels that the document has already been scrolled horizontally. | Window | ||
| scrollY : Number [read-only]
DOM Level 0
Returns the number of pixels that the document has already been scrolled vertically. | Window | ||
| self : WindowProxy [read-only]
Returns a self-reference. | Window | ||
| sessionStorage : Storage [read-only]
HTML5 | Firefox 3+
This is a global object (sessionStorage) that maintains a storage area that's available
for the duration of the page session. | Window | ||
| sidebar : Sidebar [read-only]
Non-Standard | Firefox
Returns a reference to the window object of the sidebar. | Window | ||
| status : DOMString
DOM Level 0
Sets the text in the status bar at the bottom of the browser or returns the previously set text. | Window | ||
| statusbar : BarProp [read-only]
DOM Level 0
Returns the statusbar object, whose visibility can be toggled in the window. | Window | ||
| toolbar : BarProp [read-only]
DOM Level 0
Returns the toolbar object, whose visibility can be toggled in the window. | Window | ||
| top : WindowProxy [read-only]
DOM Level 0
Returns a reference to the topmost window in the window hierarchy. | Window | ||
| window : WindowProxy [read-only]
Returns a self-reference. | Window | ||
| Method | Defined By | ||
|---|---|---|---|
Associates a function with a particular event and binds the event to the current node. | Window | ||
addEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Registers an event listener, depending on the useCapture parameter, on the
capture phase of the DOM event flow or its target and bubbling phases. | Window | ||
DOM Level 0
Display an alert dialog with the specified content and an OK button. | Window | ||
DOM Level 0
Decodes a string of data which has been encoded using base-64 encoding. | Window | ||
back():void
DOM Level 0
Returns the window to the previous item in the history. | Window | ||
blur():void
DOM Level 0
Shifts focus away from the window. | Window | ||
DOM Level 0
Creates a base-64 encoded ASCII string from a string of binary data. | Window | ||
captureEvents(eventType:DOMString):void
DOM Level 0 | OBSOLETE
Registers the window to capture all events of the specified type. | Window | ||
clearInterval(timerID:Number):void
DOM Level 0
Cancels repeated action which was set up using setInterval(). | Window | ||
clearTimeout(timerID:Number):void
DOM Level 0
Clears the delay set by window.setTimeout(). | Window | ||
close():void
DOM Level 0
Closes the current window, or a referenced window. | Window | ||
DOM Level 0
Displays a modal dialog with a message and two buttons, OK and Cancel. | Window | ||
disableExternalCapture():void
Undocumented
| Window | ||
dispatchEvent(event:Event):Boolean
Dispatches an event to fire on a node artificially. | Window | ||
DOM Level 0
Prints messages to the console. | Window | ||
enableExternalCapture():void
Undocumented
| Window | ||
DOM Level 0
Encodes a string, replacing certain characters with a hexadecimal escape sequence. | Window | ||
find(string:DOMString, caseSensitive:Boolean, backwards:Boolean, wrapAround:Boolean, wholeWord:Boolean, searchInFrames:Boolean, showDialog:Boolean):Boolean
DOM Level 0
Finds a string in a window. | Window | ||
focus():void
DOM Level 0
Sets focus on the window. | Window | ||
forward():void
DOM Level 0
Moves the window one document forward in the history. | Window | ||
GeckoActiveXObject():void
Undocumented
| Window | ||
getAttention():void
DOM Level 0
Attempts to get the user's attention. | Window | ||
getAttentionWithCycleCount():void
Undocumented
| Window | ||
This method is used to get the computed style as it is defined in CSS2. | Window | ||
DOM Level 0
Returns a selection object representing the range of text selected by the user. | Window | ||
home():void
DOM Level 0
Returns the window to the home page. | Window | ||
maximize():void
Undocumented
| Window | ||
minimize():void
Undocumented
| Window | ||
moveBy(deltaX:Number, deltaY:Number):void
DOM Level 0
Moves the current window by a specified amount. | Window | ||
moveTo(x:Number, y:Number):void
DOM Level 0
Moves the window to the specified coordinates. | Window | ||
DOM Level 0
Creates a new secondary browser window and loads the referenced resource. | Window | ||
DOM Level 0
window.openDialog is an extension to window.open. | Window | ||
HTML5 | Firefox 3
window.postMessage is a method for safely enabling cross-origin communication. | Window | ||
print():void
DOM Level 0
Opens the Print Dialog to print the current document. | Window | ||
DOM Level 0
Displays a dialog with a message prompting the user to input some text. | Window | ||
QueryInterface():void
Undocumented
| Window | ||
releaseEvents(eventType:DOMString):void
DOM Level 0 | OBSOLETE
Releases the window from trapping events of a specific type. | Window | ||
Removes an event listener. | Window | ||
removeEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener. | Window | ||
resizeBy(xDelta:Number, yDelta:Number):void
DOM Level 0
Resizes the current window by a certain amount. | Window | ||
resizeTo(width:Number, height:Number):void
DOM Level 0
Dynamically resizes window. | Window | ||
restore():void
Undocumented
| Window | ||
routeEvent():void
Undocumented
| Window | ||
scroll(xCoord:Number, yCoord:Number):void
DOM Level 0
Scrolls the window to a particular place in the document. | Window | ||
scrollBy(x:Number, y:Number):void
DOM Level 0
Scrolls the document in the window by the given amount. | Window | ||
scrollByLines(lines:Number):void
DOM Level 0
Scrolls the document by the given number of lines. | Window | ||
scrollByPages(pages:Number):void
DOM Level 0
Scrolls the current document by the specified number of pages. | Window | ||
scrollTo(xCoord:Number, yCoord:Number):void
DOM Level 0
Scrolls to a particular set of coordinates in the document. | Window | ||
DOM Level 0
Changes the cursor for the current window. | Window | ||
setInterval(func:Function, delay:Number):Number
DOM Level 0
Calls a function repeatedly, with a fixed time delay between each call to that function. | Window | ||
setResizable():void
Undocumented
| Window | ||
setTimeout(func:Function, delay:Number):Number
DOM Level 0
Executes a code snippet or a function after specified delay. | Window | ||
Non-Standard | IE4 Firefox3
Creates and displays a modal dialog box containing a specified HTML document. | Window | ||
sizeToContent():void
DOM Level 0
Sizes the window according to its content. | Window | ||
stop():void
DOM Level 0
This method stops window loading. | Window | ||
DOM Level 0
Decodes a value that has been encoded in hexadecimal (e.g., a cookie). | Window | ||
updateCommands(commandName:DOMString):void
DOM Level 0
Updates the state of commands of the current chrome window (UI). | Window | ||
XPCNativeWrapper():void
Undocumented
| Window | ||
XPCSafeJSObjectWrapper():void
Undocumented
| Window | ||
| applicationCache | property |
applicationCache:nsIDOMOfflineResourceList [read-only] Non-Standard | Firefox 3+ Returns a reference to the application cache object for the window.
public function get applicationCache():nsIDOMOfflineResourceListSee also
| closed | property |
closed:Boolean [read-only] DOM Level 0 This property indicates whether the referenced window is closed or not.
public function get closed():Boolean| Components | property |
Components:nsIXPCComponents [read-only] Non-Standard | Firefox The Components object is the object through which XPConnect functionality is reflected into JavaScript. Some properties of Components require advanced privileges and may not work in web pages.
public function get Components():nsIXPCComponents| content | property |
content:Window [read-only] Non-Standard | Firefox Returns a Window object for the primary content window.
public function get content():Window| crypto | property |
crypto:Crypto [read-only] DOM Level 0 Returns the browser crypto object, which can then be used to manipulate various browser security features.
public function get crypto():Crypto| defaultStatus | property |
defaultStatus:DOMStringDOM Level 0 Gets/sets the status bar text for the given window. Note: To set the status once the window has been opened, use window.status.
public function get defaultStatus():DOMString public function set defaultStatus(value:DOMString):void| directories | property |
directories:BarProp [read-only] DOM Level 0 Returns the window directories toolbar object.
public function get directories():BarProp| document | property |
document:DocumentView [read-only] The source DocumentView of which this is an AbstractView.
public function get document():DocumentView| frameElement | property |
frameElement:Element [read-only] DOM Level 0 Returns the element (such as <iframe> or <object>) in which the window is embedded, or null if the window is top-level.
public function get frameElement():ElementSee also
| frames | property |
frames:Array [read-only] DOM Level 0 Returns an array-like object, listing the direct sub-frames of the current window.
public function get frames():Array| fullScreen | property |
fullScreen:BooleanDOM Level 0 | Firefox 3+ This property indicates whether the window is displayed in full screen mode or not. Note: This property is only reliable in Mozilla 1.9 (Firefox 3) and later. Mozilla 1.8 and earlier do have this property, but it always returns false, even when the window is in full screen mode. Note: Switching between regular window and full screen will fire the "resize" event on the corresponding window.
public function get fullScreen():Boolean public function set fullScreen(value:Boolean):void| globalStorage | property |
globalStorage:Object [read-only] Non-Standard | Firefox 2 This is a global object (globalStorage) that maintains multiple private storage areas that can be used to hold data over a long period of time (e.g. over multiple pages and browser sessions). Note: Firefox 2 permitted access to storage objects higher in the domain hierarchy than the current document. This is no longer allowed in Firefox 3, for security reasons. In addition, this proposed addition to HTML 5 has been removed from the HTML 5 specification in favor of localStorage, which is implemented in Firefox 3.5.
public function get globalStorage():Object| history | property |
history:History [read-only] DOM Level 0 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).
public function get history():History| HTML 5 innerHeight | property |
innerHeight:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Height of the browser window viewport including, if rendered, the horizontal scrollbar.
Note: The innerHeight property will be supported in any window object like a window, a frame, a frameset or a secondary window.
public function get innerHeight():NumberSee also
var intFrameHeight = window.innerHeight; // or
var intFrameHeight = self.innerHeight; // will return the height of the frame viewport within the frameset
var intFramesetHeight = parent.innerHeight; // will return the height of the viewport of the closest frameset
var intOuterFramesetHeight = top.innerHeight; // will return the height of the viewport of the outermost frameset| HTML 5 innerWidth | property |
innerWidth:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Width of the browser window viewport including, if rendered, the vertical scrollbar.
Note: The innerWidth property does not include the sidebar. So when the sidebar is expanded, the innerWidth property value diminishes.
Note: The innerWidth property will be supported in any window object like a window, a frame, a frameset or a secondary window.
public function get innerWidth():NumberSee also
var intFrameWidth = window.innerWidth; // or
var intFrameWidth = self.innerWidth; // will return the width of the frame viewport within the frameset
var intFramesetWidth = parent.innerWidth; // will return the width of the viewport of the closest frameset
var intOuterFramesetWidth = top.innerWidth; // will return the width of the viewport of the outermost frameset| length | property |
length:Number [read-only] DOM Level 0 Returns the number of frames (either frame or iframe elements) in the window.
public function get length():Number| localStorage | property |
localStorage:Storage [read-only] Web Storage This is a global object that maintains multiple private storage areas that can be used to hold data over a long period of time (e.g. over multiple pages and browser sessions). Note Firefox 3.5: When the browser goes into private browsing mode, a new, temporary database is created to store local storage data; this database is empty, and is thrown away when private browsing mode is turned off.
public function get localStorage():StorageSee also
| location | property |
location:Location [read-only] DOM Level 0 Returns a Location object, which contains information about the URL of the document and provides methods for changing that URL.
public function get location():Location| locationbar | property |
locationbar:BarProp [read-only] DOM Level 0 Returns the locationbar object, whose visibility can be toggled in the window.
public function get locationbar():BarProp| HTML 5 media | property |
media:Media [read-only] | Product Versions : |
Returns an Media object.
public function get media():MediaSee also
| menubar | property |
menubar:BarProp [read-only] DOM Level 0 Returns the menubar object, whose visibility can be toggled in the window.
public function get menubar():BarProp| name | property |
name:DOMStringDOM Level 0 Gets/sets the name of the window. Note: The name of the window is used primarily for setting targets for hyperlinks and forms. Windows do not need to have names.
public function get name():DOMString public function set name(value:DOMString):void| navigator | property |
navigator:Navigator [read-only] DOM Level 0 Returns a reference to the navigator object, which can be queried for information about the application running the script.
public function get navigator():Navigator| onabort | property |
onabort:FunctionAn event handler for abort events sent to the window. (Not available with Firefox 2 or Safari)
public function get onabort():Function public function set onabort(value:Function):void| onbeforeunload | property |
onbeforeunload:FunctionAn event that fires before the unload event when the page is unloaded.
Note: There is no public specification. onbeforeunload was introduced by Microsoft IE 4 and has subsequently been copied by other browsers.
public function get onbeforeunload():Function public function set onbeforeunload(value:Function):voidSee also
window.onbeforeunload = function (e) {
var e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = 'Any string';
}
// For Safari
return 'Any string';
};| onblur | property |
onblur:FunctionDOM Level 0 The onblur property can be used to set the blur handler on the window, which is triggered when the window loses focus.
public function get onblur():Function public function set onblur(value:Function):void| onchange | property |
onchange:FunctionAn event handler for change events sent to the window.
public function get onchange():Function public function set onchange(value:Function):void| onclick | property |
onclick:FunctionCalled when the user clicks the mouse button while the cursor is in the window. This event is fired for any mouse button pressed; you can look at the event properties to find out which button was pressed and where.
Note: The click event is raised when the user clicks on the window.
public function get onclick():Function public function set onclick(value:Function):void| onclose | property |
onclose:FunctionAn event handler for close events sent to the window. (Not available with Firefox 2 or Safari)
public function get onclose():Function public function set onclose(value:Function):void| oncontextmenu | property |
oncontextmenu:FunctionAn event handler property for right-click events on the window.
public function get oncontextmenu():Function public function set oncontextmenu(value:Function):void
window.oncontextmenu = function () {
return false;
}
//this will disable right click on the page| ondragdrop | property |
ondragdrop:FunctionAn event handler for drag and drop events sent to the window.
Note: The window.ondragdrop property and the ondragdrop attribute are not implemented in Gecko, you have to use addEventListener.
Note: The event.data array available in NN4 seems to be unavailable in Gecko [1].
public function get ondragdrop():Function public function set ondragdrop(value:Function):voidSee also
| onerror | property |
onerror:FunctionAn event handler for error events sent to the window.
Note: When the function returns true, this prevents the firing of the default event handler. Function parameters:
Note: The error event is raised when an error occurs in the script. The example above prevents error dialogs from displaying-which is the window's normal behavior-by overriding the default event handler for error events that go to the window.
Note: When using the inline html markup (<body onerror="alert('an error occurred')>...), the arguments are not named. They can be referenced by arguments[0] through arguments[2].
public function get onerror():Function public function set onerror(value:Function):void| onfocus | property |
onfocus:FunctionAn event handler for focus events sent to the window.
Note: The focus event is raised when the user sets focus on the current window.
public function get onfocus():Function public function set onfocus(value:Function):void| onkeydown | property |
onkeydown:FunctionAn event handler for the keydown event on the window.
Note: The keydown event is raised when the user presses any key.
public function get onkeydown():Function public function set onkeydown(value:Function):void| onkeypress | property |
onkeypress:FunctionAn event handler for the keypress event on the window.
Note: The keypress event is raised when the user presses and releases any key on the keyboard.
Note: Under FF 1.0.5.4 this event fires before the keyup event is detected, i.e. it appears to work exactly like onkeydown.
public function get onkeypress():Function public function set onkeypress(value:Function):void| onkeyup | property |
onkeyup:FunctionAn event handler for the keyup event on the window.
Note: The keyup event is raised when a key that has been pressed is released.
public function get onkeyup():Function public function set onkeyup(value:Function):void| onload | property |
onload:FunctionDOM Level 0 An event handler for the load event of a window.
Note: The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images and sub-frames have finished loading.
Note: There is also Gecko-Specific DOM Events like DOMContentLoaded and DOMFrameContentLoaded events (which can be handled using addEventListener) which are fired after the DOM for the page has been constructed, but don't wait for other resources to finish loading.
public function get onload():Function public function set onload(value:Function):void| onmousedown | property |
onmousedown:FunctionAn event handler for the mousedown event on the window.
Note: The mousedown event is raised when the user clicks the mouse button anywhere in the document.
public function get onmousedown():Function public function set onmousedown(value:Function):void| onmousemove | property |
onmousemove:FunctionAn event handler for the mousemove event on the window.
Note: The mousemove event fires when the user moves the mouse pointer by 1 pixel or more in any direction in the browser window.
public function get onmousemove():Function public function set onmousemove(value:Function):void| onmouseout | property |
onmouseout:FunctionAn event handler for the mouseout event on the window.
Note: The mouseout event is raised when the mouse leaves the area of the specified element (in this case the window itself).
public function get onmouseout():Function public function set onmouseout(value:Function):void| onmouseover | property |
onmouseover:FunctionAn event handler for the mouseover event on the window.
Note: The mouseover event is raised when the mouse pointer moves over the current element (in this case the window itself).
public function get onmouseover():Function public function set onmouseover(value:Function):void| onmouseup | property |
onmouseup:FunctionAn event handler for the mouseup event on the window.
Note: The mouseup event is raised when the user unclicks the mouse button anywhere in the document.
public function get onmouseup():Function public function set onmouseup(value:Function):void| onpaint | property |
onpaint:FunctionDOM Level 0 An event handler for the paint event on the window.
Note: onpaint doesn't work currently, and it is questionable whether this event is going to work at all.
Note: The paint event is raised when the window is rendered. This event occurs after the load event for a window, and reoccurs each time the window needs to be re-rendered, as when another window obscures it and is then cleared away.
public function get onpaint():Function public function set onpaint(value:Function):voidSee also
| onreset | property |
onreset:FunctionAn event handler for the reset event on the window.
Note: The reset event is raised when the user clicks a reset button in a form ().
public function get onreset():Function public function set onreset(value:Function):void| onresize | property |
onresize:FunctionAn event handler for the resize event on the window.
Note: The resize event is fired after the window has been resized.
public function get onresize():Function public function set onresize(value:Function):void| onscroll | property |
onscroll:FunctionSpecifies the function to be called when the window is scrolled.
Note: When the window.scrollX/scrollY isn't 0 -- meaning that some scrolling occurred by either script or manual action -- reloading the current page will trigger the onscroll event immediately.
Note: In older versions of Gecko caused onscroll to be fired only when dragging the scroll bar, not when using cursor keys or mousewheel. This was fixed in Gecko 1.8/Firefox 1.5.
public function get onscroll():Function public function set onscroll(value:Function):void| onselect | property |
onselect:FunctionAn event handler for the select event on the window.
Note: The select event only fires when text inside a text input or textarea is selected. The event is fired after the text has been selected.
public function get onselect():Function public function set onselect(value:Function):void| onsubmit | property |
onsubmit:FunctionAn event handler for the submit event on the window.
Note: The submit event is raised when the user clicks a submit button in a form ().
public function get onsubmit():Function public function set onsubmit(value:Function):void| onunload | property |
onunload:FunctionDOM Level 0 The unload event is raised when the document is unloaded.
Note: Using this event handler in your page prevents Firefox 1.5 from caching the page in the in-memory bfcache.
Note: Browsers equipped with pop-up window blockers will ignore all window.open() method calls in onunload event handler functions.
public function get onunload():Function public function set onunload(value:Function):void| opener | property |
opener:WindowProxy [read-only] DOM Level 0 Returns a reference to the window that opened this current window. Note: When a window is opened from another window, it maintains a reference to that first window as window.opener. If the current window has no opener, this method returns NULL.
public function get opener():WindowProxy| HTML 5 outerHeight | property |
outerHeight:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Gets the height of the outside of the browser window. window.outerHeight represents the height of the whole browser window including toolbars and window chrome.
public function get outerHeight():NumberSee also
| HTML 5 outerWidth | property |
outerWidth:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Gets the width of the outside of the browser window. window.outerWidth represents the width of the whole browser window including sidebar (if expanded), window chrome and window [re-]sizing borders/handles.
public function get outerWidth():NumberSee also
| HTML 5 pageXOffset | property |
pageXOffset:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Returns the number of pixels that the document has already been scrolled horizontally.
Note: window.pageXOffset == window.scrollX; // always true
public function get pageXOffset():NumberSee also
// make sure and go over to the second horizontal page
if (window.scrollX) {
scroll(0,0);
}
scrollBy(400, 0);| HTML 5 pageYOffset | property |
pageYOffset:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Returns the number of CSS pixels the user has scrolled towards the bottom within the viewport.
Note: window.pageYOffset == window.scrollY; // always true
public function get pageYOffset():NumberSee also
// make sure and go over to the second horizontal page
if (window.scrollY) {
scroll(0,0);
}
scrollByPages(1);| parent | property |
parent:Window [read-only] DOM Level 0 Returns a reference to the parent of the current window or subframe. If a window does not have a parent, its parent property is a reference to itself.
public function get parent():WindowSee also
| personalbar | property |
personalbar:BarProp [read-only] Returns the personalbar object, whose visibility can be toggled in the window.
public function get personalbar():BarProp| pkcs11 | property |
pkcs11:Pkcs11 [read-only] DOM Level 0 Returns the pkcs11 object , which can be used to install drivers and other software associated with the pkcs11 protocol.
Note (Mozilla): The window.pkcs11 property has been removed in newer versions of Firefox (3.5+) for security reasons. For more information on installing PKCS11 modules, see installing PKCS11 modules. See bug 326628 for details on why the property was removed.
public function get pkcs11():Pkcs11| returnValue | property |
returnValue:* [read-only] Non-Standard? | Firefox 3+ The return value to be returned to the function that called window.showModalDialog() to display the window as a modal dialog.
public function get returnValue():*| HTML 5 screen | property |
screen:Screen [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Returns a reference to the screen object associated with the window.
public function get screen():ScreenSee also
if (screen.pixelDepth < 8) {
// use low-color version of page
} else {
// use regular, colorful page
}| HTML 5 screenX | property |
screenX:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
Note (Opera): Opera calculates the coordinates of the specific tab window relative to the encompassing browser window. This is understandable given its way of working with windows, but strictly speaking it's a bug. It should give the coordinates of the encompassing browser window relative to the screen.
public function get screenX():NumberSee also
| HTML 5 screenY | property |
screenY:Number [read-only] | Product Versions : |
| Introduced in: | DOM 0 |
Returns the vertical distance of the top border of the user's browser from the top edge of the screen.
Note (Opera): Opera calculates the coordinates of the specific tab window relative to the encompassing browser window. This is understandable given its way of working with windows, but strictly speaking it's a bug. It should give the coordinates of the encompassing browser window relative to the screen.
public function get screenY():NumberSee also
| scrollbars | property |
scrollbars:BarProp [read-only] DOM Level 0 Returns the scrollbars object, whose visibility can be toggled in the window. Note: Note that scrollbars is not an array of the scrollbars. The visibility of these objects can only be controlled as a group.
public function get scrollbars():BarProp| scrollMaxX | property |
scrollMaxX:Number [read-only] DOM Level 0 Returns the maximum number of pixels that the document can be scrolled horizontally. Note: Use this property to get the total document width, which is equivalent to window.innerWidth + window.scrollMaxX.
public function get scrollMaxX():NumberSee also
| scrollMaxY | property |
scrollMaxY:Number [read-only] DOM Level 0 Returns the maximum number of pixels that the document can be scrolled vertically. Note: Use this property to get the total document height, which is equivalent to window.innerHeight + window.scrollMaxY.
public function get scrollMaxY():NumberSee also
| scrollX | property |
scrollX:Number [read-only] DOM Level 0 Returns the number of pixels that the document has already been scrolled horizontally. Note: Use this property to check that the document hasn't already been scrolled some if you are using relative scroll functions such as window.scrollBy, window.scrollByLines, or window.scrollByPages. Note: The pageXOffset property is an alias for the scrollX property.
public function get scrollX():NumberSee also
| scrollY | property |
scrollY:Number [read-only] DOM Level 0 Returns the number of pixels that the document has already been scrolled vertically. Note: Use this property to check that the document hasn't already been scrolled some if you are using relative scroll functions such as window.scrollBy, window.scrollByLines, or window.scrollByPages. Note: The pageYOffset property is an alias for the scrollY property.
public function get scrollY():NumberSee also
| self | property |
self:WindowProxy [read-only] Returns a self-reference.
public function get self():WindowProxy| sessionStorage | property |
sessionStorage:Storage [read-only] HTML5 | Firefox 3+ This is a global object (sessionStorage) that maintains a storage area that's available for the duration of the page session. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated. The sessionStorage object is most useful for hanging on to temporary data that should be saved and restored if the browser is accidentally refreshed. Note: Prior to Firefox 3.5, sessionStorage data was not restored automatically after recovering from a browser crash. Starting in Firefox 3.5, this works as per the specification.
public function get sessionStorage():Storage| sidebar | property |
sidebar:Sidebar [read-only] Non-Standard | Firefox Returns a reference to the window object of the sidebar.
public function get sidebar():Sidebar| status | property |
status:DOMStringDOM Level 0 Sets the text in the status bar at the bottom of the browser or returns the previously set text. Note Firefox: This property does not work in default configuration of Firefox and some other browsers: setting window.status has no effect on the text displayed in the status bar. To allow scripts change the the status bar text, the user must set the dom.disable_window_status_change preference to false in the about:config screen.
public function get status():DOMString public function set status(value:DOMString):void| statusbar | property |
statusbar:BarProp [read-only] DOM Level 0 Returns the statusbar object, whose visibility can be toggled in the window.
public function get statusbar():BarProp| toolbar | property |
toolbar:BarProp [read-only] DOM Level 0 Returns the toolbar object, whose visibility can be toggled in the window.
public function get toolbar():BarProp| top | property |
top:WindowProxy [read-only] DOM Level 0 Returns a reference to the topmost window in the window hierarchy.
public function get top():WindowProxy| window | property |
window:WindowProxy [read-only] Returns a self-reference.
public function get window():WindowProxy| addEventListener | () | method |
public function addEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):voidAssociates a function with a particular event and binds the event to the current node.
Parameters
type:DOMString — A string representing the event to bind, without the "on" prefix. For example, "click", "mousedown" etc.
| |
listener:EventListener — The function or method to associate with the event.
| |
useCapture:Boolean — Whether to bind the event as it is propagating towards the target node, (event Capture), or as the
event bubbles upwards from the target (event bubble). Set to true or false, respectively.
|
| addEventListenerNS | () | method |
public function addEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):voidRegisters an event listener, depending on the useCapture parameter, on the capture phase of the DOM event flow or its target and bubbling phases.
Parameters
namespaceURI:DOMString — Specifies the Event.namespaceURI associated with the event for which the user is registering.
| |
type:DOMString — A string representing the event to bind, without the "on" prefix. For example, "click", "mousedown" etc.
| |
listener:EventListener — The function or method to associate with the event.
| |
useCapture:Boolean — Whether to bind the event as it is propagating towards the target node, (event Capture), or as the
event bubbles upwards from the target (event bubble). Set to true or false, respectively.
|
| alert | () | method |
public function alert(message:DOMString):voidDOM Level 0 Display an alert dialog with the specified content and an OK button.
Parameters
message:DOMString — Text you want to display in the alert dialog, or, alternatively, an
object that is converted into a string and displayed.
|
See also
| atob | () | method |
public function atob(encodedData:DOMString):DOMStringDOM Level 0 Decodes a string of data which has been encoded using base-64 encoding.
Parameters
encodedData:DOMString — The encoded string
|
DOMString — The decoded string
|
See also
| back | () | method |
public function back():voidDOM Level 0 Returns the window to the previous item in the history.
| blur | () | method |
public function blur():voidDOM Level 0 Shifts focus away from the window.
| btoa | () | method |
public function btoa(stringToEncode:DOMString):DOMStringDOM Level 0 Creates a base-64 encoded ASCII string from a string of binary data.
Parameters
stringToEncode:DOMString — The string to encode
|
DOMString — The encoded string
|
See also
| captureEvents | () | method |
public function captureEvents(eventType:DOMString):voidDOM Level 0 | OBSOLETE Registers the window to capture all events of the specified type. Note: This method is obsolete as of Gecko 1.9, in favor of W3C DOM Events methods (see addEventListener). The support for this method has been removed from Gecko 1.9. Note: Events raised in the DOM by user activity (such as clicking buttons or shifting focus away from the current document) generally pass through the high-level window and document objects first before arriving at the object that initiated the event. Note: When you call the captureEvents() method on the window, events of the type you specify (for example, Event.CLICK) no longer pass through to "lower" objects in the hierarchy. In order for events to "bubble up" in the way that they normally do, you must call window.releaseEvents() (Obsolete ) on the window to keep it from trapping events. Note: Note that you can pass a list of events to this method using the following syntax: window.caputureEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP).
Parameters
eventType:DOMString — The event type to capture.
|
See also
| clearInterval | () | method |
public function clearInterval(timerID:Number):voidDOM Level 0 Cancels repeated action which was set up using setInterval().
Parameters
timerID:Number — The identifier of the repeated action you want to cancel.
|
See also
| clearTimeout | () | method |
public function clearTimeout(timerID:Number):voidDOM Level 0 Clears the delay set by window.setTimeout().
Parameters
timerID:Number — The ID of the timeout you wish you clear
|
See also
| close | () | method |
public function close():voidDOM Level 0 Closes the current window, or a referenced window.
When this method is called, the referenced window is closed.
This method is only allowed to be called for windows that were opened by a script using the window.open method. If the window was not opened by a script, the following error appears in the JavaScript Console: Scripts may not close windows that were not opened by script.
See also
| confirm | () | method |
public function confirm(message:DOMString):BooleanDOM Level 0 Displays a modal dialog with a message and two buttons, OK and Cancel.
Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).
Parameters
message:DOMString — The string to be displayed in the dialog.
|
Boolean — Value indicating whether OK or Cancel was selected (true means OK).
|
See also
| disableExternalCapture | () | method |
public function disableExternalCapture():voidUndocumented
See also
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanDispatches an event to fire on a node artificially.
Note (IE): IE's equivalent of dispatchEvent() is fireEvent().
Parameters
event:Event — The event to be dispatched.
|
Boolean — Indicates whether any of the listeners which handled the
event called Event.preventDefault(). If Event.preventDefault() was
called the returned value is false, else it is true.
|
| dump | () | method |
public function dump(message:DOMString):voidDOM Level 0 Prints messages to the console.
Note: In Gecko dump is disabled by default – it doesn't do anything but doesn't raise an error either. To see the dump output you have to enable it by setting the preference browser.dom.window.dump.enabled to true. You can set the preference in about:config or in a user.js file. Note: this preference is not listed in about:config by default, you may need to create it (right-click the content area -> New -> Boolean).
Note: On Windows, you will need a console to actually see anything. If you don't have one already, closing the application and re-opening it with the command line parameter -console should create the console. On other operating systems, it's enough to launch the application from a terminal.
Parameters
message:DOMString — Message to log.
|
| enableExternalCapture | () | method |
public function enableExternalCapture():voidUndocumented
See also
| escape | () | method |
public function escape(regular:DOMString):DOMStringDOM Level 0 Encodes a string, replacing certain characters with a hexadecimal escape sequence.
Note: The escape() method converts special characters (any characters that are not regular text or numbers) into hexadecimal characters, which is especially necessary for setting the values of cookies. Also useful when passing name=value pairs in the URL of a GET request, or an AJAX GET/POST request.
Parameters
regular:DOMString — A regular string.
|
DOMString — The encoded string.
|
See also
| find | () | method |
public function find(string:DOMString, caseSensitive:Boolean, backwards:Boolean, wrapAround:Boolean, wholeWord:Boolean, searchInFrames:Boolean, showDialog:Boolean):BooleanDOM Level 0 Finds a string in a window.
Parameters
string:DOMString — The text string for which to search.
| |
caseSensitive:Boolean — If true, specifies a case-sensitive search.
| |
backwards:Boolean — If true, specifies a backward search.
| |
wrapAround:Boolean — If true, specifies a wrap around search.
| |
wholeWord:Boolean — If true, specifies a whole word search.
| |
searchInFrames:Boolean — If true, specifies a search in frames.
| |
showDialog:Boolean — If true, specifies a show Dialog.
|
Boolean — true if the string is found; otherwise, false.
|
| focus | () | method |
public function focus():voidDOM Level 0 Sets focus on the window.
| forward | () | method |
public function forward():voidDOM Level 0 Moves the window one document forward in the history.
| GeckoActiveXObject | () | method |
public function GeckoActiveXObject():voidUndocumented
See also
| getAttention | () | method |
public function getAttention():voidDOM Level 0 Attempts to get the user's attention. How this happens varies based on OS and window manager.
Note: On Windows, the taskbar button for the window flashes, if this hasn't been disabled by the user.
Note: On Linux, the behaviour varies from window manager to window manager - some flash the taskbar button, others focus the window immediately. This may be configurable as well.
Note: On Macintosh, the icon in the upper right corner of the desktop flashes.
Note: The function is disabled for web content. Neither Gecko nor Internet Explorer supports this feature now for web content. getAttention will still work when used from chrome in a Gecko application.
| getAttentionWithCycleCount | () | method |
public function getAttentionWithCycleCount():voidUndocumented
See also
| getComputedStyle | () | method |
public function getComputedStyle(elt:Element, pseudoElt:DOMString):CSSStyleDeclarationThis method is used to get the computed style as it is defined in CSS2.
Parameters
elt:Element — The element whose style is to be computed. This parameter cannot be null.
| |
pseudoElt:DOMString — The pseudo-element or null if none.
|
CSSStyleDeclaration — The computed style. The CSSStyleDeclaration is read-only and contains only absolute values.
|
| getSelection | () | method |
public function getSelection():SelectionDOM Level 0 Returns a selection object representing the range of text selected by the user.
In JavaScript, when a selection object is passed to a function expecting a string (like window.alert or document.write ), a string representation of it (i.e. the selected text) is passed instead. This makes the selection object appear like a string, when it is really an object with its own properties and methods. Specifically, the return value of calling the toString() method of the Selection object is passed.
ReturnsSelection — A Selection object.
|
| home | () | method |
public function home():voidDOM Level 0 Returns the window to the home page.
| maximize | () | method |
public function maximize():voidUndocumented
See also
| minimize | () | method |
public function minimize():voidUndocumented
See also
| moveBy | () | method |
public function moveBy(deltaX:Number, deltaY:Number):voidDOM Level 0 Moves the current window by a specified amount.
Note: You can use negative numbers as parameters for this function. This function makes a relative move while window.moveTo makes an absolute move.
Parameters
deltaX:Number — Amount of pixels to move the window horizontally.
| |
deltaY:Number — Amount of pixels to move the window vertically.
|
function budge() {
moveBy(10, -10);
}
| moveTo | () | method |
public function moveTo(x:Number, y:Number):voidDOM Level 0 Moves the window to the specified coordinates.
Note: This function moves the window absolutely while window.moveBy moves the window relative to its current location.
Parameters
x:Number — The horizontal coordinate to be moved to.
| |
y:Number — The vertical coordinate to be moved to.
|
function origin() {
// moves to top left corner of screen
window.moveTo(0, 0)
}
| open | () | method |
public function open(url:DOMString, windowName:DOMString, windowFeatures:DOMString):WindowProxyDOM Level 0 Creates a new secondary browser window and loads the referenced resource.
The open() method creates a new secondary browser window, similar to choosing New Window from the File menu. The strUrl parameter specifies the URL to be fetched and loaded in the new window. If strUrl is an empty string, then a new blank, empty window (URL about:blank loaded) is created with the default toolbars of the main window.
Note: Note that remote URLs won't load immediately. When window.open() returns, the window always contains about:blank. The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.
Note: If you use the strWindowFeatures parameter, then only list the features you want to include in the new window, that you want to be enabled or rendered; the others (except titlebar and close) will be disabled, removed.
The following features require the UniversalBrowserWrite privilege, otherwise they will be ignored. Chrome scripts have this privilege automatically, others have to request it from the PrivilegeManager.
Parameters
url:DOMString — This is the URL to be loaded in the newly opened window. It can be an HTML document on the web,
it can be an image file or any type of file which is supported by the browser.
| |
windowName:DOMString — This is the string that just names the new window. Such string can be used to be the target
of links and forms when the target attribute of an <a> element or of a <form> is specified. This string parameter
should not contain any blank space. strWindowName does not specify the title of the new window.
| |
windowFeatures:DOMString — Optional parameter. This parameter is the string which lists the requested window features
(window functionalities and toolbars) of the new browser window. This string parameter must not contain any blank space.
Each requested window feature must be separated by a comma inside the character string.
|
WindowProxy — This is the reference pointing to the newly created browser window. This reference is the return value of the
open() method; it will be null if for some reasons the execution did not succeed to open the window. A global variable
is best used to store such reference. You can then, for example, use it to look for properties of the new window or access
its methods, assuming that your main versus secondary window relationship complies with Same origin policy security requirements.
|
See also
<script type="text/javascript">
var WindowObjectReference = null; // global variable
function openFFPromotionPopup() {
if(WindowObjectReference == null || WindowObjectReference.closed) {
//if the pointer to the window object in memory does not exist or if such pointer exists but the window was closed
WindowObjectReference = window.open("http://www.spreadfirefox.com/", "PromoteFirefoxWindowName", "resizable=yes,scrollbars=yes,status=yes");
// then create it. The new window will be created and will be brought on top of any other window.
} else {
WindowObjectReference.focus();
// else the window reference must exist and the window is not closed; therefore, we can bring it back on top of any other window with the focus() method. There would be no need to re-create the window or to reload the referenced resource.
};
}
</script>
(...)
<p><a href="http://www.spreadfirefox.com/" target="PromoteFirefoxWindowName" onclick="openFFPromotionPopup(); return false;" title="This link will create a new window or will re-use an already opened one">Promote Firefox adoption</a></p>
| openDialog | () | method |
public function openDialog(url:DOMString, name:DOMString, features:DOMString, ... args):WindowProxyDOM Level 0 window.openDialog is an extension to window.open. It behaves the same, except that it can optionally take one or more parameters past windowFeatures, and windowFeatures itself is treated a little differently.
The optional parameters, if present, will be bundled up in a JavaScript Array object and added to the newly created window as a property named window.arguments. They may be referenced in the JavaScript of the window at any time, including during the execution of a load handler. These parameters may be used, then, to pass arguments to and from the dialog window.
Note: The call to openDialog() returns immediately. If you want the call to block until the user has closed the dialog, supply modal as a windowFeatures parameter.
Note: This also means the user won't be able to interact with the opener window until he closes the modal dialog.
To pass extra parameters into the dialog, you can simply supply them after the windowFeatures parameter:
openDialog("http://example.tld/zzz.xul", "dlg", "", "pizza", 6.98);To access these extra parameters from within dialog code, use the following scheme:
var food = window.arguments[0];
var price = window.arguments[1];Parameters
url:DOMString — This is the URL to be loaded in the newly opened window. It can be an HTML document on the web,
it can be an image file or any type of file which is supported by the browser.
| |
name:DOMString — This is the string that just names the new window. Such string can be used to be the target
of links and forms when the target attribute of an <a> element or of a <form> is specified. This string parameter
should not contain any blank space. strWindowName does not specify the title of the new window.
| |
features:DOMString — Optional parameter. This parameter is the string which lists the requested window features
(window functionalities and toolbars) of the new browser window. This string parameter must not contain any blank space.
Each requested window feature must be separated by a comma inside the character string.
| |
... args — The arguments to be passed to the new window (optional).
|
WindowProxy — The opened window
|
var win = openDialog("http://example.tld/zzz.xul", "dlg", "", "pizza", 6.98);| postMessage | () | method |
public function postMessage(message:DOMString, targetOrigin:DOMString):voidHTML5 | Firefox 3 window.postMessage is a method for safely enabling cross-origin communication.
Normally, scripts on different pages are only allowed to access each other if and only if the pages which executed them are at locations with the same protocol (usually both http), port number (80 being the default for http), and host (modulo document.domain being set by both pages to the same value). window.postMessage provides a controlled mechanism to circumvent this restriction in a way which is secure when properly used.
window.postMessage, when called, causes a MessageEvent to be dispatched at the target window when any pending script that must be executed completes (e.g. remaining event handlers if window.postMessage is called from an event handler, previously-set pending timeouts, etc.). The MessageEvent has the type message, a data property which is set to the string value of the first argument provided to window.postMessage, an origin property corresponding to the origin of the main document in the window calling window.postMessage at the time window.postMessage was called, and a source property which is the window from which window.postMessage is called. (Other standard properties of events are present with their expected values.)
Note: Any window may access this method on any other window, at any time, regardless of the location of the document in the window, to send it a message. Consequently, any event listener used to receive messages must first check the identity of the sender of the message, using the origin and possibly source properties. This cannot be understated: Failure to check the origin and possibly source properties enables cross-site scripting attacks.
Parameters
message:DOMString — String data to be sent to the other window.
| |
targetOrigin:DOMString — Specifies what the origin of otherWindow must be for the event to be dispatched, either as the literal
string "*" (indicating no preference) or as a URI. If at the time the event is scheduled to be dispatched the scheme, hostname,
or port of otherWindow's document does not match that provided in targetOrigin, the event will not be dispatched; only if all
three match will the event be dispatched. This mechanism provides control over where messages are sent; for example, if
postMessage were used to transmit a password, it would be absolutely critical that this argument be a URI whose origin is the
same as the intended receiver of the message containing the password, to prevent interception of the password by a malicious third party.
|
See also
// otherWindow: A reference to another window; such a reference may be obtained, for example, using the
// contentWindow property of an iframe element, the object returned by window.open, or by named or
// numeric index on window.frames.
otherWindow.postMessage(message, targetOrigin);
// In window A's scripts, with A being on <http://example.com:8080>:
var popup = window.open(...popup details...);
// When the popup has fully loaded, if not blocked by a popup blocker:
// This does nothing, assuming the window hasn't changed its location.
popup.postMessage("The user is 'bob' and the password is 'secret'", "http://secure.example.net");
// This will successfully queue a message to be sent to the popup, assuming the window hasn't changed its location.
popup.postMessage("hello there!", "http://example.org");
function receiveMessage(event) {
// Do we trust the sender of this message? (might be different from what we originally opened, for example).
if (event.origin !== "http://example.org") return;
// event.source is popup
// event.data is "hi there yourself! the secret response is: rheeeeet!"
}
window.addEventListener("message", receiveMessage, false);
// In the popup's scripts, running on <http://example.org>:
// Called sometime after postMessage is called
function receiveMessage(event) {
// Do we trust the sender of this message?
if (event.origin !== "http://example.com:8080") return;
// event.source is window.opener
// event.data is "hello there!"
// Assuming you've verified the origin of the received message (which
// you must do in any case), a convenient idiom for replying to a
// message is to call postMessage on event.source and provide event.origin as the targetOrigin.
event.source.postMessage("hi there yourself! the secret response " + "is: rheeeeet!", event.origin);
}
window.addEventListener("message", receiveMessage, false);| () | method |
public function print():voidDOM Level 0 Opens the Print Dialog to print the current document.
| prompt | () | method |
public function prompt(text:DOMString, value:DOMString):DOMStringDOM Level 0 Displays a dialog with a message prompting the user to input some text.
Note: A prompt dialog contains a single-line textbox, a Cancel button, and an OK button, and returns the (possibly empty) text the user inputted into that textbox.
Note: Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).
Parameters
text:DOMString — Text to display to the user.
| |
value:DOMString — The default value displayed in the text input field. It is an optional parameter.
|
DOMString — The text entered by the user, or the value null.
|
| QueryInterface | () | method |
public function QueryInterface():voidUndocumented
See also
| releaseEvents | () | method |
public function releaseEvents(eventType:DOMString):voidDOM Level 0 | OBSOLETE Releases the window from trapping events of a specific type.
Note: that you can pass a list of events to this method using the following syntax: window.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP).
Parameters
eventType:DOMString — The event type to release.
|
See also
window.releaseEvents(Event.KEYPRESS)| removeEventListener | () | method |
public function removeEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):voidRemoves an event listener.
Calling removeEventListener with arguments which do not identify any currently registered EventListener on the EventTarget has no effect. The Event.namespaceURI for which the user registered the event listener is implied and is null.
Parameters
type:DOMString — Specifies the Event.type for which the user registered
the event listener.
| |
listener:EventListener — The EventListener to be removed.
| |
useCapture:Boolean — Specifies whether the EventListener being removed
was registered for the capture phase or not. If a listener was
registered twice, once for the capture phase and once for the target
and bubbling phases, each must be removed separately. Removal of an
event listener registered for the capture phase does not affect the
same event listener registered for the target and bubbling phases,
and vice versa.
|
| removeEventListenerNS | () | method |
public function removeEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):voidRemoves an event listener. Calling removeEventListenerNS with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
Parameters
namespaceURI:DOMString — Specifies the Event.namespaceURI associated with the event for which the user registered the event listener.
| |
type:DOMString — Specifies the Event.type for which the user registered
the event listener.
| |
listener:EventListener — The EventListener to be removed.
| |
useCapture:Boolean — Specifies whether the EventListener being removed
was registered for the capture phase or not. If a listener was
registered twice, once for the capture phase and once for the target
and bubbling phases, each must be removed separately. Removal of an
event listener registered for the capture phase does not affect the
same event listener registered for the target and bubbling phases,
and vice versa.
|
| resizeBy | () | method |
public function resizeBy(xDelta:Number, yDelta:Number):voidDOM Level 0 Resizes the current window by a certain amount.
Note: This method resizes the window relative to its current size. To resize the window in absolute terms, use window.resizeTo.
Parameters
xDelta:Number — The number of pixels to grow the window horizontally.
| |
yDelta:Number — The number of pixels to grow the window vertically.
|
See also
// shrink the window
window.resizeBy(-200, -200);| resizeTo | () | method |
public function resizeTo(width:Number, height:Number):voidDOM Level 0 Dynamically resizes window.
Parameters
width:Number — The new width in pixels.
| |
height:Number — The new height in pixels.
|
See also
| restore | () | method |
public function restore():voidUndocumented
See also
| routeEvent | () | method |
public function routeEvent():voidUndocumented
See also
| scroll | () | method |
public function scroll(xCoord:Number, yCoord:Number):voidDOM Level 0 Scrolls the window to a particular place in the document.
Parameters
xCoord:Number — The pixel along the horizontal axis of the document that you want displayed in the upper left.
| |
yCoord:Number — The pixel along the vertical axis of the document that you want displayed in the upper left.
|
// put the 100th vertical pixel at the top of the window
<button onClick="scroll(0, 100);">click to scroll down 100 pixels</button>| scrollBy | () | method |
public function scrollBy(x:Number, y:Number):voidDOM Level 0 Scrolls the document in the window by the given amount.
Note: Positive co-ordinates will scroll to the right and down the page. Negative values will scroll to the left and up the page.
Parameters
x:Number — the offset in pixels to scroll horizontally.
| |
y:Number — the offset in pixels to scroll vertically.
|
// scroll one page
window.scrollBy(0, window.innerHeight);| scrollByLines | () | method |
public function scrollByLines(lines:Number):voidDOM Level 0 Scrolls the document by the given number of lines.
Parameters
lines:Number — The number of lines to scroll the document by.
|
// scroll down the document by 5 lines.
<button onclick="scrollByLines(5);">down 5 lines</button>| scrollByPages | () | method |
public function scrollByPages(pages:Number):voidDOM Level 0 Scrolls the current document by the specified number of pages.
Parameters
pages:Number — The number of pages to scroll.
|
// scroll down the document by 1 page
window.scrollByPages(1);| scrollTo | () | method |
public function scrollTo(xCoord:Number, yCoord:Number):voidDOM Level 0 Scrolls to a particular set of coordinates in the document.
Parameters
xCoord:Number — The pixel along the horizontal axis of the document that you want displayed in the upper left.
| |
yCoord:Number — The pixel along the vertical axis of the document that you want displayed in the upper left.
|
window.scrollTo(0, 1000);
| setCursor | () | method |
public function setCursor(state:DOMString):voidDOM Level 0 Changes the cursor for the current window.
Note: The cursor isn't reset until it's set back to auto.
Note: This function is unavailable to web pages, which can use CSS cursor property instead.
Parameters
state:DOMString — What state to set the cursor to. Valid settings can be: "wait", "auto"...
|
| setInterval | () | method |
public function setInterval(func:Function, delay:Number):Number
DOM Level 0
Calls a function repeatedly, with a fixed time delay between each call to that function.
Note: setInterval() will pass the number of milliseconds late the callback was called into
the callback function, which can confuse it if it expects something else as an argument. To
sidestep that problem, use an anonymous function to call your callback.
Note: When you pass a method to setInterval() (or any other function, for that matter), it
will be invoked with a wrong this value.
Parameters
func:Function — The function you want to be called repeatedly.
| |
delay:Number — The number of milliseconds (thousandths of a second) that the setInterval() function should wait before each call to func.
|
Number — A unique interval ID
|
See also
| setResizable | () | method |
public function setResizable():voidUndocumented
See also
| setTimeout | () | method |
public function setTimeout(func:Function, delay:Number):Number
DOM Level 0
Executes a code snippet or a function after specified delay.
Note: Code executed by setTimeout() is run in a separate execution context to the function from
which it was called. As a consequence, the this keyword for the called function will be set to
the window (or global) object, it will not be the same as the this value for the function that
called setTimeout.
Parameters
func:Function — The function you want to execute after delay milliseconds.
| |
delay:Number — The number of milliseconds (thousandths of a second) that the function call should be delayed by.
|
Number — The ID of the timeout
|
See also
| showModalDialog | () | method |
public function showModalDialog(uri:DOMString, arguments:DOMString = null, options:* = null):*Non-Standard | IE4 Firefox3 Creates and displays a modal dialog box containing a specified HTML document.
Note: Firefox does not implement the dialogHide, edge, status, or unadorned arguments.
Parameters
uri:DOMString — The URI of the document to display in the dialog box.
| |
arguments:DOMString (default = null) — An optional variant that contains values that should be passed to the dialog box; these are made available in the window object's window.dialogArguments property.
| |
options:* (default = null) — An optional string that specifies window ornamentation for the dialog box, using one or more semicolon delimited values:
|
* — The returnValue property as set by the window of the document specified by uri.
|
See also
| sizeToContent | () | method |
public function sizeToContent():voidDOM Level 0 Sizes the window according to its content.
The DOM content should be loaded when this function is called, for example after the DOMContentLoaded event.
| stop | () | method |
public function stop():voidDOM Level 0 This method stops window loading.
Note: The stop() method is exactly equivalent to clicking the stop button in the browser. Because of the order in which scripts are loaded, the stop() method cannot stop the document in which it is contained from loading, but it will stop the loading of large images, new windows, and other objects whose loading is deferred.
| unescape | () | method |
public function unescape(escaped:DOMString):DOMStringDOM Level 0 Decodes a value that has been encoded in hexadecimal (e.g., a cookie).
Parameters
escaped:DOMString — The encoded string.
|
DOMString — The decoded string.
|
alert(unescape("%5C")); // displays "\"| updateCommands | () | method |
public function updateCommands(commandName:DOMString):voidDOM Level 0 Updates the state of commands of the current chrome window (UI).
Note: This enables or disables items (setting or clearing the "disabled" attribute on the command node as appropriate), or ensures that the command state reflects the state of the selection by setting current state information in the "state" attribute of the XUL command nodes.
Parameters
commandName:DOMString — A particular string which describes what kind of update event this is (e.g. whether we are in bold right now).
|
| XPCNativeWrapper | () | method |
public function XPCNativeWrapper():voidUndocumented
See also
| XPCSafeJSObjectWrapper | () | method |
public function XPCSafeJSObjectWrapper():voidUndocumented
See also