« Gecko DOM Reference
This section provides a brief reference for all of the methods, properties, and events available through the DOM window object. The window object implements the Window interface, which in turn inherits from the AbstractView interface.
The window object represents the window itself. The document property of a window points to the DOM document loaded in that window. A window for a given document can be obtained using the document.defaultView
property.
In a tabbed browser, such as Firefox, each tab contains its own window object (and if you're writing an extension, the browser window itself is a separate window too - see Working with windows in chrome code for more information). That is, the window object is not shared between tabs in the same window. Some methods, namely window.resizeTo
and window.resizeBy
apply to the whole window and not to the specific tab the window object belongs to. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.
Properties
- window.applicationCache New in Firefox 3
- An
nsIDOMOfflineResourceList
object providing access to the offline resources for the window.
- window.closed
- This property indicates whether the current window is closed or not.
- window.Components
- The entry point to many XPCOM features. Some properties, e.g. classes, are only available to sufficiently privileged code.
- window.content and window._content
- Returns a reference to the content element in the current window. The variant with underscore is deprecated.
- window.controllers
- Returns the XUL controller objects for the current chrome window.
- window.crypto
- Returns the browser crypto object.
- window.defaultStatus
- Gets/sets the status bar text for the given window.
- window.dialogArguments New in Firefox 3
- Gets the arguments passed to the window (if it's a dialog box) at the time
window.showModalDialog() was called. This is an nsIArray
.
- window.directories
- Returns a reference to the directories toolbar in the current chrome.
- window.document
- Returns a reference to the document that the window contains.
- window.frameElement
- Returns the element in which the window is embedded, or null if the window is not embedded.
- window.frames
- Returns an array of the subframes in the current window.
- window.fullScreen New in Firefox 3
- This property indicates whether the window is displayed in full screen or not.
- window.globalStorage New in Firefox 2
- Multiple storage objects that are used for storing data across multiple pages.
- window.history
- Returns a reference to the history object.
- window.innerHeight
- Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
- window.innerWidth
- Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
- window.length
- Returns the number of frames in the window.
- window.location
- Gets/sets the location, or current URL, of the window object.
- window.locationbar
- Returns the locationbar object, whose visibility can be toggled in the window.
- window.menubar
- Returns the menubar object, whose visibility can be toggled in the window.
- window.name
- Gets/sets the name of the window.
- window.navigator
- Returns a reference to the navigator object.
- window.opener
- Returns a reference to the window that opened this current window.
- window.outerHeight
- Gets the height of the outside of the browser window.
- window.outerWidth
- Gets the width of the outside of the browser window.
- window.pageXOffset
- An alias for window.scrollX.
- window.pageYOffset
- An alias for window.scrollY
- window.parent
- Returns a reference to the parent of the current window or subframe.
- window.personalbar
- Returns the personalbar object, whose visibility can be toggled in the window.
- window.pkcs11
- Returns the pkcs11 object, which can be used to install drivers and other software associated with the pkcs11 protocol.
- window.returnValue New in Firefox 3
- The return value to be returned to the function that called
window.showModalDialog() to display the window as a modal dialog.
- window.screen
- Returns a reference to the screen object associated with the window.
- window.screen.availTop
- Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
- window.screen.availLeft
- Returns the first available pixel available from the left side of the screen.
- window.screen.availHeight
- Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
- window.screen.availWidth
- Returns the amount of horizontal space in pixels available to the window.
- window.screen.colorDepth
- Returns the color depth of the screen.
- window.screen.height
- Returns the height of the screen in pixels.
- window.screen.left
- Returns the current distance in pixels from the left side of the screen.
- window.screen.pixelDepth
- Gets the bit depth of the screen.
- window.screen.top
- Returns the distance from the top of the screen.
- window.screen.width
- Returns the width of the screen.
- window.screenX
- Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
- window.screenY
- Returns the vertical distance of the top border of the user's browser from the top side of the screen.
- window.scrollbars
- Returns the scrollbars object, whose visibility can be toggled in the window.
- window.scrollMaxX
- The maximum offset that the window can be scrolled to horizontally.
- (i.e., the document width minus the viewport width)
- window.scrollMaxY
- The maximum offset that the window can be scrolled to vertically.
- (i.e., the document height minus the viewport height)
- window.scrollX
- Returns the number of pixels that the document has already been scrolled horizontally.
- window.scrollY
- Returns the number of pixels that the document has already been scrolled vertically.
- window.self
- Returns an object reference to the window object itself.
- window.sessionStorage New in Firefox 2
- A storage object for storing data within a single page session.
- window.sidebar
- Returns a reference to the window object of the sidebar.
- window.status
- Gets/sets the text in the statusbar at the bottom of the browser.
- window.statusbar
- Returns the statusbar object, whose visibility can be toggled in the window.
- window.toolbar
- Returns the toolbar object, whose visibility can be toggled in the window.
- window.top
- Returns a reference to the topmost window in the window hierarchy.
- window.window
- Returns a reference to the current window.