Skip to content

Common Window Properties

Common window properties

Property

Description

closed

Returns a Boolean value indicating whether or not a window has been closed

defaultStatus

Sets or returns the default text in the status bar of a window
The defaultStatus and status properties can be set only if users have modified their browsers to allow it (very unlikely).

document

Returns the document object for the window

frames

Returns an array of all the frames and iframes in the window

history

Returns the history object for the window
The history object cannot be read from (so you cannot see where your visitors have been surfing), but it supports the length property to determine how long the history is, and the back, forward, and go methods to navigate to specific pages in the history.

innerHeight

Sets or returns the inner height of a window's content area
When you need to know how much space there is available in a current window of the web browser, just read the values in window.innerHeight and window.innerWidth.

innerWidth

Sets or returns the inner width of a window's content area
When you need to know how much space there is available in a current window of the web browser, just read the values in window.innerHeight and window.innerWidth.

length

Returns the number of frames and iframes in a window

location

Returns the location object for the window

name

Sets or returns the name of a window

navigator

Returns the navigator object for the window

opener

Returns a reference to the window that created the window

outerHeight

Sets or returns the outer height of a window, including tool and scroll bars

outWidth

Sets or returns the outer width of a window, including tool and scroll bars

pageXOffset

Returns the number of pixels the document has been scrolled horizontally from the left of the window

pageYOffset

Returns the number of pixels the document has been scrolled vertically from the top of the window

parent

Returns the parent window of a window

screen

Returns the screen object for the window
The screen object supports the read-only properties availHeight, availWidth, colorDepth, height, pixelDepth, and width, and is therefore great for determining information about the user's display.

screenLeft

Returns the x coordinate of the window relative to the screen in all recent browsers except Mozilla Firefox (for which you should use screenX)

screenTop

Returns the y coordinate of the window relative to the screen in all recent browsers except Mozilla Firefox (for which you should use screenY)

screenX

Returns the x coordinate of the window relative to the screen in all recent browsers except Opera, which returns incorrect values; supported in versions of IE prior to 9

screenY

Returns the y coordinate of the window relative to the screen in all recent browsers except Opera, which returns incorrect values; supported in versions of IE prior to 9

self

Returns the current window

status

Sets or returns the text in the status bar of a window
The defaultStatus and status properties can be set only if users have modified their browsers to allow it (very unlikely).

top

Returns the top browser window

天上的神明与星辰,人间的艺术和真纯,我们所敬畏和热爱的,莫过于此。