Window Object

## JavaScript Reference

Overview

## JavaScript Objects

JS Array JS Boolean JS Date JS Math JS Number JS String JS RegExp JS Global

## Browser Objects

Window Navigator Screen History Location

## HTML DOM Objects

DOM Document DOM Elements DOM Attributes DOM Events

## HTML Objects

DOM Anchor DOM Area DOM Base DOM Body DOM Button DOM Form DOM Frame/IFrame DOM Frameset DOM Image DOM Input Button DOM Input Checkbox DOM Input File DOM Input Hidden DOM Input Password DOM Input Radio DOM Input Reset DOM Input Submit DOM Input Text DOM Link DOM Meta DOM Object DOM Option DOM Select DOM Style DOM Table DOM td / th DOM tr DOM Textarea

# The Window Object

« Previous
Next Reference »

## Window Object

The window object represents an open window in a browser.

If a document contain frames (<frame> or <iframe> tags), the browser creates one window object for the HTML document, and one additional window object for each frame.

Note: There is no public standard that applies to the Window object, but all major browsers support it.

## Window Object Properties

Property | Description
--- | ---
closed | Returns a Boolean value indicating whether a window has been closed or not
defaultStatus | Sets or returns the default text in the statusbar of a window
document | Returns the Document object for the window (See Document object)
frames | Returns an array of all the frames (including iframes) in the current window
history | Returns the History object for the window (See History object)
innerHeight | Sets or returns the inner height of a window's content area
innerWidth | Sets or returns the inner width of a window's content area
length | Returns the number of frames (including iframes) in a window
location | Returns the Location object for the window (See Location object)
name | Sets or returns the name of a window
navigator | Returns the Navigator object for the window (See Navigator object)
opener | Returns a reference to the window that created the window
outerHeight | Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth | Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset | Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset | Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent | Returns the parent window of the current window
screen | Returns the Screen object for the window (See Screen object)
screenLeft | Returns the x coordinate of the window relative to the screen
screenTop | Returns the y coordinate of the window relative to the screen
screenX | Returns the x coordinate of the window relative to the screen
screenY | Returns the y coordinate of the window relative to the screen
self | Returns the current window
status | Sets or returns the text in the statusbar of a window
top | Returns the topmost browser window

## Window Object Methods

Method | Description
--- | ---
alert() | Displays an alert box with a message and an OK button
atob() | Decodes a base-64 encoded string
blur() | Removes focus from the current window
btoa() | Encodes a string in base-64
clearInterval() | Clears a timer set with setInterval()
clearTimeout() | Clears a timer set with setTimeout()
close() | Closes the current window
confirm() | Displays a dialog box with a message and an OK and a Cancel button
createPopup() | Creates a pop-up window
focus() | Sets focus to the current window
moveBy() | Moves a window relative to its current position
moveTo() | Moves a window to the specified position
open() | Opens a new browser window
print() | Prints the content of the current window
prompt() | Displays a dialog box that prompts the visitor for input
resizeBy() | Resizes the window by the specified pixels
resizeTo() | Resizes the window to the specified width and height
scroll() | This method has been replaced by the scrollTo() method.
scrollBy() | Scrolls the content by the specified number of pixels
scrollTo() | Scrolls the content to the specified coordinates
setInterval() | Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout() | Calls a function or evaluates an expression after a specified number of milliseconds
stop() | Stops the window from loading

« Previous
Next Reference »

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE