Window objectSupport in all current engines.
window.windowwindow.frameswindow.selfThese attributes all return window.
window.documentReturns the Document associated with window.
document.defaultViewReturns the Window object of the active document.
window = window.open([ url [, target [, features ] ] ])Opens a window to show url (defaults to "about:blank"), and returns
it. target (defaults to "_blank") gives the name of the new
window. If a window already exists with that name, it is reused. The features
argument can contain a set of comma-separated tokens:
noopener"noreferrer"These behave equivalently to the noopener and noreferrer link types on hyperlinks.
popup"Encourages user agents to provide a minimal web browser user interface for the new
window. (Impacts the visible getter on all
BarProp objects as well.)
globalThis. open( "https://email.example/message/CAOOOkFcWW97r8yg=SsWg7GgCmp4suVX9o85y8BvNRqMjuc5PXg" , undefined , "noopener,popup" );
window.name [ = value ]Returns the name of the window.
Can be set, to change the name.
window.close()Closes the window.
window.closedReturns true if the window has been closed, false otherwise.
window.stop()Cancels the document load.
window.lengthReturns the number of document-tree child browsing contexts.
window[index]Returns the indicated document-tree child browsing context.
Window objectwindow[name]Returns the indicated element or collection of elements.
As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to
this API can vary over time, as new features are added to the web platform, for example. Instead
of this, use document.getElementById() or document.querySelector().
To close a browsing context browsingContext, run these steps:
If the result of calling prompt to unload with browsingContext's
active document is "refuse", then return.
Unload browsingContext's active document.
Remove browsingContext from the user interface (e.g., close or hide its tab in a tabbed browser).
Discard browsingContext.
User agents should offer users the ability to arbitrarily close any top-level browsing context.
For historical reasons, the Window interface had some attributes that represented
the visibility of certain web browser interface elements.
For privacy and interoperability reasons, those attributes now return values that represent
whether the Window's browsing context's is
popup property is true or false.
Each interface element is represented by a BarProp object:
window.locationbar.visibleSupport in all current engines.
window..visiblewindow.personalbar.visiblewindow.scrollbars.visiblewindow.statusbar.visiblewindow.toolbar.visibleReturns true if the top-level browsing context is not a popup; otherwise, returns false.