Javascript Reference - Window Object








The window object represents an open window in a browser.

Window Object Properties

Property Description
closed whether a window has been closed or not
defaultStatus Sets or gets the default text in the statusbar of a window
document Get the Document object for the window
frames Get an array of all the frames including iframes in the current window
history Get the History object for the window
innerHeight Get the inner height of a window's content area
innerWidth Get the inner width of a window's content area
length Get the number of frames (including iframes) in a window
location Get the Location object for the window
name Sets or gets the name of a window
navigator Get the Navigator object for the window
opener Get a reference to the window that created the window
outerHeight Get the outer height of a window, including toolbars/scrollbars
outerWidth Get the outer width of a window, including toolbars/scrollbars
pageXOffset Get the pixels offset scrolled horizontally from the upper left corner
pageYOffset Get the pixels offset scrolled vertically from the upper left corner
parent Get the parent window of the current window
screen Get the Screen object for the window
screenLeft Get the x coordinate of the window relative to the screen
screenTop Get the y coordinate of the window relative to the screen
screenX Get the x coordinate of the window relative to the screen
screenY Get the y coordinate of the window relative to the screen
self Get the current window
status Sets or gets the text in the statusbar of a window
top Get 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() Deprecated. 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 at specified intervals in milliseconds
setTimeout() Calls a function after a specified number of milliseconds
stop() Stops the window from loading