Browser/User Agent Support
| IE | Mozilla | Netscape | Opera | Safari | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
|---|
Constructors
| Constructor | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
Creates a new instance of a Window object. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
Gets or sets the default text in the status bar at the bottom of a web browser window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Gets or sets the name of a window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Fires when the loading of the element is cancelled before it finishes loading. | 4.0+ | no | no | no | 1.0+ |
Fires immediately after a user prints or print previews a document. | 4.0+ | no | no | no | no |
Fires immediately before a user prints or print previews a document. | 4.0+ | no | no | no | no |
Fires immediately before a document is unloaded. | 4.0+ | no | no | no | no |
Event handler for blur events on a window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Fires when the value of the element changes. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the element is clicked. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the user closes the window. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when a user drops a file onto the window. | no | no | 4.0+ | no | no |
Event handler for errors raised on a window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Event handler for focus events on a window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Fires when a user presses the F1 key to activate help. | 4.0+ | no | no | no | no |
Fires when a user presses down on a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when a user presses a key or holds down the key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when a user releases a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Event handler for window loading. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Fires when a user clicks down on the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse moves while the pointer over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse pointer moves off of the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse pointer moves over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the user releases the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Event handler for window move events. | no | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Fires when the form data is reset. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Event handler for window resizing. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Fires when a user scrolls the element. | 4.0+ | no | no | no | 1.0+ |
Fires when the element is selected. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the form data is submitted. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Event handler for unload events on the window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Gets or sets the text in the status bar at the bottom of a web browser window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Indicates whether a window is closed or not. | 4.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ |
Reference to the document that the window contains. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Instance of an Event that is available to an event handler. | 4.0+ | no | no | 7.0+ | 1.0+ |
An array of the frames in the current window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to the History object. | 3.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ |
Number of frames in the window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Gets or sets the current URL of a window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to an object holding math functions and constants. | 3.0+ | 1.0+ | 2.0+ | no | no |
Reference to the Navigator object. | 3.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ |
Reference to the window that opened the current window. | 3.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ |
Reference to the parent of the current window or subframe. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to the Screen object associated with the window. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ |
Reference to a Window object itself. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to the top window in the window hierarchy. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to the current Window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Reference to an XMLHttpRequest object. | 5.0+ | 1.0+ | 7.0+ | no | 1.2+ |
Methods
| Method | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
Displays an alert dialogue box. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Moves back one step in the Window history. | 1.0+ | 4.0+ | 7.0+ | 1.0+ | |
Removes focus from the Window. | 4.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ |
Sets the Window to capture all events of the specified type. | no | no | 4.0+ | no | no |
Clears a delay that was set with the setInterval method. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Clears a timeout that was set with the setTimeout method. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Closes the current window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Displays a confirmation dialogue box. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Sets the focus on the current Window. | 4.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ |
Moves forward one step in the Window history. | no | no | 4.0+ | 7.0+ | no |
Computes style information and returns the CSSStyleDeclaration for the specified document Element. | 6.0+ | 1.0+ | 6.0+ | no | 1.0+ |
Calls the event handler for the specified event. | no | no | 4.0+ | no | no |
Returns the browser Window to the browser home page. | no | no | 4.0+ | 7.0+ | no |
Moves a Window by the specified amount. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Moves the Window to the specified location. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Automatically navigates to the specified URL. | 3.0+ | no | no | no | no |
Opens a new Window. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Prints the contents of the current Window. | 5.0+ | 1.0+ | 4.0+ | 7.0+ | no |
Displays a dialogue box that prompts the user for input. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Sets the Window to release all captured events of a specified type. | no | no | 4.0+ | 7.0+ | no |
Resizes the current window by the specified amount. | 4.0+ | no | 4.0+ | 7.0+ | 1.0+ |
Resizes the current window to the specified size. | 4.0+ | no | 4.0+ | 7.0+ | 1.0+ |
Routes a captured event through the event hierarchy. | no | no | 4.0+ | no | no |
Scrolls the window to a specified place in the document. | 4.0+ | 1.0+ | 3.0+ | no | 1.0+ |
Scrolls the current document in the window by the specified amount. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Scrolls the window to a specified place in the document. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Calls a function or evaluates an expression every time the specified interval elapses. | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+ |
Specifies a delay for calling a function or evaluating an expression. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ |
Stops the window from loading. | no | no | 4.0+ | 7.0+ | no |
References
Availability
JavaScript 1.0 | enhanced in JavaScript 1.1 and 1.2
Constructor Detail
Property Detail
String defaultStatus
Gets or sets the default text in the status bar at the bottom of a web browser window.
- See Also
- Availability
JavaScript 1.0
String name
Gets or sets the name of a window.
- See Also
- Availability
JavaScript 1.0 | read/write in JavaScript 1.1
static Function onabort - read only
Fires when the loading of the element is cancelled before it finishes loading.
static Function onafterprint - read only
Fires immediately after a user prints or print previews a document.
static Function onbeforeprint - read only
Fires immediately before a user prints or print previews a document.
static Function onbeforeunload - read only
Fires immediately before a document is unloaded.
static Function onblur - read only
Event handler for blur events on a window.
- See Also
Window.blur | Window.focus | Window.onfocus | Event | EventListener | EventTarget
- Availability
HTML DOM Level 0
static Function onchange - read only
Fires when the value of the element changes.
static Function onclick - read only
Fires when the element is clicked.
static Function onclose - read only
Fires when the user closes the window.
static Function ondragdrop - read only
Fires when a user drops a file onto the window.
static Function onerror - read only
Event handler for errors raised on a window.
- Availability
JavaScript 1.1 | buggy in Netscape 6/6.1
static Function onfocus - read only
Event handler for focus events on a window.
- See Also
Window.blur | Window.focus | Window.onblur | Event | EventListener | EventTarget
- Availability
JavaScript 1.1
static Function onhelp - read only
Fires when a user presses the F1 key to activate help.
static Function onkeydown - read only
Fires when a user presses down on a key while the element has focus.
static Function onkeypress - read only
Fires when a user presses a key or holds down the key while the element has focus.
static Function onkeyup - read only
Fires when a user releases a key while the element has focus.
static Function onload - read only
Event handler for window loading.
- See Also
- Availability
JavaScript 1.0
static Function onmousedown - read only
Fires when a user clicks down on the mouse button while the element has focus.
static Function onmousemove - read only
Fires when the mouse moves while the pointer over the element.
static Function onmouseout - read only
Fires when the mouse pointer moves off of the element.
static Function onmouseover - read only
Fires when the mouse pointer moves over the element.
static Function onmouseup - read only
Fires when the user releases the mouse button while the element has focus.
static Function onmove - read only
Event handler for window move events.
static Function onreset - read only
Fires when the form data is reset.
static Function onresize - read only
Event handler for window resizing.
- Availability
JavaScript 1.2
static Function onscroll - read only
Fires when a user scrolls the element.
static Function onselect - read only
Fires when the element is selected.
static Function onsubmit - read only
Fires when the form data is submitted.
static Function onunload
Event handler for unload events on the window.
- See Also
- Availability
JavaScript 1.0
String status
Gets or sets the text in the status bar at the bottom of a web browser window.
- See Also
- Availability
JavaScript 1.0
Boolean closed
Indicates whether a window is closed or not.
Document document
Reference to the document that the window contains.
- See Also
Event event
Instance of an Event that is available to an event handler.
- See Also
Array frames
An array of the frames in the current window.
History history
Reference to the History object.
- See Also
Number length
Number of frames in the window.
Location location
Gets or sets the current URL of a window.
Math Math
Reference to an object holding math functions and constants.
- See Also
Navigator navigator
Reference to the Navigator object.
- See Also
Window opener
Reference to the window that opened the current window.
Window parent
Reference to the parent of the current window or subframe.
Screen screen
Reference to the Screen object associated with the window.
- See Also
Window self
Reference to a Window object itself.
Window top
Reference to the top window in the window hierarchy.
Window window
Reference to the current Window.
- See Also
XMLHttpRequest XMLHttpRequest
Reference to an XMLHttpRequest object.
- See Also
- Availability
HTML DOM Level 3
Method Detail
alert() : void
Displays an alert dialogue box.
- See Also
- Availability
JavaScript 1.0
back() : void
Moves back one step in the Window history.
blur() : void
Removes focus from the Window.
- See Also
- Availability
JavaScript 1.1
captureEvents(Number eventmask) : void
Sets the Window to capture all events of the specified type.
| Number | eventmask | Type of event to capture. |
- See Also
Event | Window.handleEvent | Window.releaseEvents | Window.routeEvent | EventTarget.addEventListener
clearInterval(Object intervalId) : void
Clears a delay that was set with the setInterval method.
| Object | intervalId | Identifier for the interval. |
- See Also
- Availability
HTML DOM Level 0
clearTimeout(Object timeoutId) : void
Clears a timeout that was set with the setTimeout method.
| Object | timeoutId | Identifier for the timeout. |
- See Also
- Availability
HTML DOM Level 0
close() : void
Closes the current window.
- See Also
- Availability
JavaScript 1.0
confirm(String question) : Boolean
Displays a confirmation dialogue box.
| String | question | Text to display to ask the user a "yes" or "no" question to confirm or cancel. |
- See Also
- Availability
HTML DOM Level 0
focus() : void
Sets the focus on the current Window.
- See Also
- Availability
HTML DOM Level 0
forward() : void
Moves forward one step in the Window history.
getComputedStyle(Element elt, String pseudoElt) : static CSSStyleDeclaration
Computes style information and returns the CSSStyleDeclaration for the specified document Element.
| Element | elt | Document element to get the style information for. |
| String | pseudoElt | CSS pseudoelement. |
- See Also
- Availability
HTML DOM Level 2
handleEvent(Object event) : Object
Calls the event handler for the specified event.
| Object | event | Event to have the event handler called for. |
- See Also
home() : void
Returns the browser Window to the browser home page.
- Availability
HTML DOM Level 0
moveBy(Number dx, Number dy) : void
Moves a Window by the specified amount.
| Number | dx | Number of pixels to move the window to the right. Use a negative value to move the window to the left. |
| Number | dy | Number of pixels to move the window towards the bottom of the screen. Use a negative value to move the window up. |
- Availability
JavaScript 1.2
moveTo(Object x, Object y) : void
Moves the Window to the specified location.
| Object | x | Number of pixels from the left edge of the screen to set the horizontal position. |
| Object | y | Number of pixels from the top edge of the screen to set the vertical position. |
- Availability
JavaScript 1.2
navigate(String url) : void
Automatically navigates to the specified URL.
| String | url | URL to navigate to. |
- See Also
open([String url,] [String name,] [String features,] [Boolean replace]) : Window
Opens a new Window.
| String | url | Sets the URL of the new Window. (optional) |
| String | name | Sets the name of the new Window. (optional) |
| String | features | Comma-separated list of features for the new Window to have. (optional) |
| Boolean | replace | Whether or not the URL in the new window should create a new entry in the browser history or replace the current URL. (optional) |
- See Also
Location.replace | Window.close | the closed and opener properties of Window
- Availability
HTML DOM Level 0
print() : void
Prints the contents of the current Window.
- Availability
HTML DOM Level 0
prompt(String message, String default) : StringNumber
Displays a dialogue box that prompts the user for input.
| String | message | Text message or question to display to the user. |
| String | default | Default value to display in the text field. |
- See Also
- Availability
HTML DOM Level 0
releaseEvents(Number eventmask) : void
Sets the Window to release all captured events of a specified type.
| Number | eventmask | Type of event to stop capturing. |
- See Also
Event | Window.captureEvents | Window.handleEvent | Window.routeEvent | EventTarget.removeEventListener
resizeBy(Number dw, Number dh) : void
Resizes the current window by the specified amount.
| Number | dw | Number of pixels to resize the window horizontally. |
| Number | dh | Number of pixels to resize the window vertically. |
- Availability
JavaScript 1.2
resizeTo(Object width, Object height) : void
Resizes the current window to the specified size.
| Object | width | Number of pixels wide that the window should be. |
| Object | height | Number of pixels tall that the window should be. |
routeEvent(Function event) : Object
Routes a captured event through the event hierarchy.
| Function | event | Event to be routed. |
scroll(Object x, Object y) : void
Scrolls the window to a specified place in the document.
| Object | x | Horizontal position (in pixels) to scroll to. |
| Object | y | Vertical position (in pixels) to scroll to. |
- Availability
JavaScript 1.1 | deprecated in JavaScript 1.2
scrollBy(Number dx, Number dy) : void
Scrolls the current document in the window by the specified amount.
| Number | dx | Number of pixels to scroll horizontally. |
| Number | dy | Number of pixels to scroll vertically. |
- Availability
JavaScript 1.2
scrollTo(Object x, Object y) : void
Scrolls the window to a specified place in the document.
| Object | x | Horizontal position (in pixels) to scroll to. |
| Object | y | Vertical position (in pixels) to scroll to. |
- Availability
JavaScript 1.2
setInterval(String code, Function func, Number interval, Array args...) : Number
Calls a function or evaluates an expression every time the specified interval elapses.
| String | code | Expression to be evaluated (not required if func is used). |
| Function | func | Function to be called (not required if code is used). |
| Number | interval | Number of milliseconds to wait. |
| Array | args... | Arguments (if any) to be taken by the function. (zero-or-more) |
- See Also
- Availability
JavaScript 1.2 | IE 4 supports only one of the two forms
setTimeout(String code, Function func, String delay, Array args) : Number
Specifies a delay for calling a function or evaluating an expression.
| String | code | Expression to be evaluated (not required if func is used). |
| Function | func | Function to be called (not required if code is used). |
| String | delay | Number of milliseconds to wait. |
| Array | args | Arguments (if any) to be taken by the function. |
- See Also
- Availability
JavaScript 1.0
stop() : void
Stops the window from loading.
- Availability
HTML DOM Level 0
