Window

Originally published on June 14, 2016.
Last updated on June 30, 2016.

Contents

<script>// <![CDATA[
document.writeln("<b>userAgent:</b> " + navigator["userAgent"] + "<br />");
document.writeln("<br />");
document.writeln(window + "<br />");
for (x in window) {
    document.writeln("[" + (typeof window[x]) + "] <b>" + x + " :</b> " +
        window[x] + "<br />");
}
// ]]></script>


[object Window]

$: undefined

jQuery: function (a,b){return new n.fn.init(a,b)}

Interfaces

BarProp


Document


DOMHighResTimeStamp


DOMString


Element


EventTarget


GlobalEventHandlers


History


Location


Navigator


Window

[PrimaryGlobal, LegacyUnenumerableNamedProperties]
/*sealed*/ interface Window : EventTarget {
    // the current browsing context
    [Unforgeable] readonly attribute WindowProxy window;
    [Replaceable] readonly attribute WindowProxy self;
    [Unforgeable] readonly attribute Document document;
                           attribute DOMString name;
    [PutForwards=href, Unforgeable] readonly attribute Location location;
                  readonly attribute History history;
    [Replaceable] readonly attribute BarProp locationbar;
    [Replaceable] readonly attribute BarProp menubar;
    [Replaceable] readonly attribute BarProp personalbar;
    [Replaceable] readonly attribute BarProp scrollbars;
    [Replaceable] readonly attribute BarProp statusbar;
    [Replaceable] readonly attribute BarProp toolbar;
                           attribute DOMString status;
    void close         ();
                  readonly attribute boolean closed;
    void stop          ();
    void focus         ();
    void blur          ();

    // other browsing contexts
    [Replaceable] readonly attribute WindowProxy frames;
    [Replaceable] readonly attribute unsigned long length;
    [Unforgeable] readonly attribute WindowProxy top;
                           attribute any opener;
    [Replaceable] readonly attribute WindowProxy parent;
                  readonly attribute Element? frameElement;
    WindowProxy open   (optional DOMString url = "about:blank",
                        optional DOMString target = "_blank",
                        [TreatNullAs=EmptyString] optional DOMString features = "",
                        optional boolean replace = false);
    getter WindowProxy (unsigned long index);
    getter object      (DOMString name);

    // the user agent
                  readonly attribute Navigator navigator;

    // user prompts
    void alert         ();
    void alert         (DOMString message);
    boolean confirm    (optional DOMString message = "");
    DOMString? prompt  (optional DOMString message = "",
                        optional DOMString default = "");
    void print         ();

    // deprecated
    any showModalDialog(DOMString url,
                        optional any argument);

    unsigned long requestAnimationFrame(FrameRequestCallback callback);
    void cancelAnimationFrame(unsigned long handle);
};
Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;

callback FrameRequestCallback = void (DOMHighResTimeStamp time);

(6.3. The Window Object in HTML Editor’s Draft, June 2, 2016 http://w3c.github.io/html/browsers.html#window-window)

WindowEventHandlers


WindowProxy


Attributes

window.closed

Property Type Value
closed Boolean

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

window.devicePixelRatio

Property Type Value
devicePixelRatio Number

window.frameElement

Property Type Value
frameElement Element

window.fullScreen

Property Type Value
fullScreen Boolean

window.innerHeight

Property Type Value
innerHeight Number

window.innerWidth

Property Type Value
innerWidth Number

window.length

Property Type Value
length Number

Returns the number of <iframe> elements in the current window.

window.location

Property Type Value
location object

window.mozInnerScreenX

Property Type Value
mozInnerScreenX Number

window.mozInnerScreenY

Property Type Value
mozInnerScreenY Number

window.mozPaintCount

Property Type Value
mozPaintCount Number

window.name

Property Type Value
name String

Sets or returns the name of a window.

window.outerHeight

Property Type Value
outerHeight Number

window.outerWidth

Property Type Value
outerWidth Number

window.pageXOffset

Property Type Value
pageXOffset Number

window.pageYOffset

Property Type Value
pageYOffset Number

window.screenX

Property Type Value
screenX Number

window.screenY

Property Type Value
screenY Number

window.scrollMaxX

Property Type Value
scrollMaxX Number

window.scrollMaxY

Property Type Value
scrollMaxY Number

window.scrollX

Property Type Value
scrollX Number

window.scrollY

Property Type Value
scrollY Number

window.status

Property Type Value
status String

Sets or returns the text in the statusbar of a window.

window.wpNotesIsJetpackClient

Property Type Value
wpNotesIsJetpackClient Boolean

window.wpNotesIsJetpackClientV2

Property Type Value
wpNotesIsJetpackClientV2 Boolean

Methods

window.addEventListener()

Method Returns Value
addEventListener()
Defined in _____. Tested in _____. Undefined in _____.

window.alert()

Method Returns Value
alert()
Displays an alert box with a message and an OK button. Defined in _____. Tested in _____. Undefined in _____.

window.atob()

Method Returns Value
atob()
Defined in _____. Tested in _____. Undefined in _____. Takes the input data, in the form of a Unicode string containing base64-encoded binary data, decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary data. Throws an InvalidCharacterError exception if the input string is not valid base64 data.

window.blur()

Method Returns Value
blur()
Defined in _____. Tested in _____. Undefined in _____. Removes focus from the current window.

window.btoa()

Method Returns Value
btoa()
Defined in _____. Tested in _____. Undefined in _____. Takes the input data, in the form of a Unicode string containing only characters in the range U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and converts it to its base64 representation, which it returns. Throws an InvalidCharacterError exception if the input string contains any out-of-range characters.

window.cancelAnimationFrame()

Method Returns Value
cancelAnimationFrame()
Defined in _____. Tested in _____. Undefined in _____.

window.captureEvents()

Method Returns Value
captureEvents()
Defined in _____. Tested in _____. Undefined in _____.

window.clearInterval()

Method Returns Value
clearInterval()
Defined in _____. Tested in _____. Undefined in _____. Clears a timer set with setInterval().

window.clearTimeout()

Method Returns Value
clearTimeout()
Defined in _____. Tested in _____. Undefined in _____. Clears a timer set with setTimeout().

window.close()

close: function close() { [native code] } Closes the current window.

window.confirm()

confirm: function confirm() { [native code] } Displays a dialog box with a message and an OK and a Cancel button.

window.createImageBitmap()

createImageBitmap: function createImageBitmap() { [native code] }

window.dispatchEvent()

dispatchEvent: function dispatchEvent() { [native code] }

window.dump()

dump: function dump() { [native code] }

window.fetch()

fetch: function fetch() { [native code] }

window.find()

find: function find() { [native code] }

window.focus()

focus: function focus() { [native code] } Sets focus to the current window.

window.getComputedStyle()

getComputedStyle: function getComputedStyle() { [native code] } Gets the current computed CSS styles applied to an element.

window.getDefaultComputedStyle()

getDefaultComputedStyle: function getDefaultComputedStyle() { [native code] }

window.getSelection()

getSelection: function getSelection() { [native code] } Returns a Selection object representing the range of text selected by the user.

window.matchMedia()

matchMedia: function matchMedia() { [native code] } Returns a MediaQueryList object representing the specified CSS media query string.

window.moveBy()

moveBy: function moveBy() { [native code] } Moves a window relative to its current position.

window.moveTo()

moveTo: function moveTo() { [native code] } Moves a window to the specified position.

window.open()

open: function open() { [native code] } Opens a new browser window.

window.postMessage()

postMessage: function postMessage() { [native code] }

window.print()

print: function print() { [native code] } Prints the content of the current window.

window.prompt()

prompt: function prompt() { [native code] } Displays a dialog box that prompts the visitor for input.

window.releaseEvents()

releaseEvents: function releaseEvents() { [native code] }

window.removeEventListener()

removeEventListener: function removeEventListener() { [native code] }

window.requestAnimationFrame()

requestAnimationFrame: function requestAnimationFrame() { [native code] }

window.resizeBy()

resizeBy: function resizeBy() { [native code] } Resizes the window by the specified pixels.

window.resizeTo()

resizeTo: function resizeTo() { [native code] } Resizes the window to the specified width and height.

window.scroll()

scroll: function scroll() { [native code] } Deprecated. This method has been replaced by the scrollTo() method.

window.scrollBy()

scrollBy: function scrollBy() { [native code] } Scrolls the document by the specified number of pixels.

window.scrollByLines()

scrollByLines: function scrollByLines() { [native code] }

window.scrollByPages()

scrollByPages: function scrollByPages() { [native code] }

window.scrollTo()

scrollTo: function scrollTo() { [native code] } Scrolls the document to the specified coordinates.

window.setInterval()

setInterval: function setInterval() { [native code] } Calls a function or evaluates an expression at specified intervals (in milliseconds).

window.setResizable()

setResizable: function setResizable() { [native code] }

window.setTimeout()

setTimeout: function setTimeout() { [native code] } Calls a function or evaluates an expression after a specified number of milliseconds.

window.showModalDialog()

showModalDialog: function showModalDialog() { [native code] }

window.sizeToContent()

sizeToContent: function sizeToContent() { [native code] }

window.stop()

stop: function stop() { [native code] } Stops the window from loading.

window.updateCommands()

updateCommands: function updateCommands() { [native code] }

Events

window.onabort

onabort: null

window.onabsolutedeviceorientation

onabsolutedeviceorientation: null

window.onafterprint

onafterprint: null

window.onbeforeprint

onbeforeprint: null

window.onbeforeunload

onbeforeunload: null

window.onblur

onblur: null

window.oncanplay

oncanplay: null

window.oncanplaythrough

oncanplaythrough: null

window.onchange

onchange: null

window.onclick

onclick: null

window.oncontextmenu

oncontextmenu: null

window.ondblclick

ondblclick: null

window.ondevicelight

ondevicelight: null

window.ondevicemotion

ondevicemotion: null

window.ondeviceorientation

ondeviceorientation: null

window.ondeviceproximity

ondeviceproximity: null

window.ondrag

ondrag: null

window.ondragend

ondragend: null

window.ondragenter

ondragenter: null

window.ondragleave

ondragleave: null

window.ondragover

ondragover: null

window.ondragstart

ondragstart: null

window.ondrop

ondrop: null

window.ondurationchange

ondurationchange: null

window.onemptied

onemptied: null

window.onended

onended: null

window.onerror

onerror: null

window.onfocus

onfocus: null

window.onhashchange

onhashchange: null

window.oninput

oninput: null

window.oninvalid

oninvalid: null

window.onkeydown

onkeydown: null

window.onkeypress

onkeypress: null

window.onkeyup

onkeyup: null

window.onlanguagechange

onlanguagechange: null

window.onload

onload: null

window.onloadeddata

onloadeddata: null

window.onloadedmetadata

onloadedmetadata: null

window.onloadstart

onloadstart: null

window.onmessage

onmessage: null

window.onmousedown

onmousedown: null

window.onmouseenter

onmouseenter: null

window.onmouseleave

onmouseleave: null

window.onmousemove

onmousemove: null

window.onmouseout

onmouseout: null

window.onmouseover

onmouseover: null

window.onmouseup

onmouseup: null

window.onmozfullscreenchange

onmozfullscreenchange: null

window.onmozfullscreenerror

onmozfullscreenerror: null

window.onmozpointerlockchange

onmozpointerlockchange: null

window.onmozpointerlockerror

onmozpointerlockerror: null

window.onoffline

onoffline: null

window.ononline

ononline: null

window.onpagehide

onpagehide: null

window.onpageshow

onpageshow: null

window.onpause

onpause: null

window.onplay

onplay: null

window.onplaying

onplaying: null

window.onpopstate

onpopstate: null

window.onprogress

onprogress: null

window.onratechange

onratechange: null

window.onreset

onreset: null

window.onresize

onresize: null

window.onscroll

onscroll: null

window.onseeked

onseeked: null

window.onseeking

onseeking: null

window.onselect

onselect: null

window.onshow

onshow: null

window.onstalled

onstalled: null

window.onstorage

onstorage: null

window.onsubmit

onsubmit: null

window.onsuspend

onsuspend: null

window.ontimeupdate

ontimeupdate: null

window.onunload

onunload: null

window.onuserproximity

onuserproximity: null

window.onvolumechange

onvolumechange: null

window.onwaiting

onwaiting: null

window.onwheel

onwheel: null

Objects

window.applicationCache

Property Type Value
applicationCache OfflineResourceList
<script>// <![CDATA[
document.writeln(window.applicationCache + "<br />");
for (x in window.applicationCache) {
    document.writeln("<b>" + x + " :</b> " + window.applicationCache[x] + "<br />");
}
// ]]></script>

window.caches

Property Type Value
caches CacheStorage
<script>// <![CDATA[
document.writeln(window.caches + "<br />");
for (x in window.caches) {
    document.writeln("<b>" + x + " :</b> " + window.caches[x] + "<br />");
}
// ]]></script>

window.console

Property Type Value
console Console
<script>// <![CDATA[
document.writeln(window.console + "<br />");
for (x in window.console) {
    document.writeln("<b>" + x + " :</b> " + window.console[x] + "<br />");
}
// ]]></script>

window.content

Property Type Value
content Window
<script>// <![CDATA[
document.writeln(window.content + "<br />");
for (x in window.content) {
    document.writeln("<b>" + x + " :</b> " + window.content[x] + "<br />");
}
// ]]></script>

window.crypto

Property Type Value
crypto Crypto
<script>// <![CDATA[
document.writeln(window.crypto + "<br />");
for (x in window.crypto) {
    document.writeln("<b>" + x + " :</b> " + window.crypto[x] + "<br />");
}
// ]]></script>

window.document

Property Type Value
document HTMLDocument
<script>// <![CDATA[
document.writeln(window.document + "<br />");
for (x in window.document) {
    document.writeln("<b>" + x + " :</b> " + window.document[x] + "<br />");
}
// ]]></script>

window.external

Property Type Value
external External
<script>// <![CDATA[
document.writeln(window.external + "<br />");
for (x in window.external) {
    document.writeln("<b>" + x + " :</b> " + window.external[x] + "<br />");
}
// ]]></script>

window.frames

Property Type Value
frames Window
<script>// <![CDATA[
document.writeln(window.frames + "<br />");
for (x in window.frames) {
    document.writeln("<b>" + x + " :</b> " + window.frames[x] + "<br />");
}
// ]]></script>

window.history

Property Type Value
history History
Property Type Value
object History
length Number
scrollRestoration String
back() function
forward() function
go() function
pushState() function
replaceState() function
<script>// <![CDATA[
document.writeln(window.history + "<br />");
for (x in window.history) {
    document.write("<b>" + x + " :</b> " + window.history[x].toSource() + "<br />");
}
// ]]></script>

window.indexedDB

Property Type Value
indexedDB IDBFactory
<script>// <![CDATA[
document.writeln(window.indexedDB + "<br />");
for (x in window.indexedDB) {
    document.writeln("<b>" + x + " :</b> " + window.indexedDB[x] + "<br />");
}
// ]]></script>

window.InstallTrigger

Property Type Value
InstallTrigger InstallTriggerImpl
<script>// <![CDATA[
document.writeln(window.InstallTrigger + "<br />");
for (x in window.InstallTrigger) {
    document.writeln("<b>" + x + " :</b> " + window.InstallTrigger[x] + "<br />");
}
// ]]></script>

window.localStorage

Property Type Value
localStorage Storage
<script>// <![CDATA[
document.writeln(window.localStorage + "<br />");
for (x in window.localStorage) {
    document.writeln("<b>" + x + " :</b> " + window.localStorage[x] + "<br />");
}
// ]]></script>

window.locationbar

Property Type Value
locationbar BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.locationbar + "<br />");
for (x in window.locationbar) {
    document.write("<b>" + x + " :</b> " + window.locationbar[x].toSource() + "<br />");
}
// ]]></script>

window.menubar

Property Type Value
menubar BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.menubar + "<br />");
for (x in window.menubar) {
    document.write("<b>" + x + " :</b> " + window.menubar[x].toSource() + "<br />");
}
// ]]></script>

window.navigator

Property Type Value
navigator Navigator
<script>// <![CDATA[
document.writeln(window.navigator + "<br />");
for (x in window.navigator) {
    document.writeln("<b>" + x + " :</b> " + window.navigator[x] + "<br />");
}
// ]]></script>

window.opener

Property Type Value
opener Window
<script>// <![CDATA[
document.writeln(window.opener + "<br />");
for (x in window.opener) {
    document.writeln("<b>" + x + " :</b> " + window.opener[x] + "<br />");
}
// ]]></script>

window.parent

Property Type Value
parent Window
<script>// <![CDATA[
document.writeln(window.parent + "<br />");
for (x in window.parent) {
    document.writeln("<b>" + x + " :</b> " + window.parent[x] + "<br />");
}
// ]]></script>

window.performance

Property Type Value
performance Performance
<script>// <![CDATA[
document.writeln(window.performance + "<br />");
for (x in window.performance) {
    document.writeln("<b>" + x + " :</b> " + window.performance[x] + "<br />");
}
// ]]></script>

window.personalbar

Property Type Value
personalbar BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.personalbar + "<br />");
for (x in window.personalbar) {
    document.write("<b>" + x + " :</b> " + window.personalbar[x] + "<br />");
}
// ]]></script>

window.screen

Property Type Value
screen Screen
Property Type Value
object Screen

The window.screen object is described in more detail on the Screen page.

<script>// <![CDATA[
document.write(window.screen + "<br />");
for (x in window.screen) {
    document.write("<b>" + x + " :</b> " + window.screen[x] + "<br />");
}
// ]]></script>

window.scrollbars

Property Type Value
scrollbars BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.scrollbars + "<br />");
for (x in window.scrollbars) {
    document.write("<b>" + x + " :</b> " + window.scrollbars[x].toSource() + "<br />");
}
// ]]></script>

window.self

Property Type Value
self Window
<script>// <![CDATA[
document.writeln(window.self + "<br />");
for (x in window.self) {
    document.write("<b>" + x + " :</b> " + window.self[x] + "<br />");
}
// ]]></script>

window.sessionStorage

Property Type Value
sessionStorage Storage

tbody>

<script>// <![CDATA[
document.writeln(window.sessionStorage + "<br />");
for (x in window.sessionStorage) {
    document.write("<b>" + x + " :</b> " + window.sessionStorage[x] + "<br />");
}
// ]]></script>

window.sidebar

Property Type Value
sidebar External
<script>// <![CDATA[
document.writeln(window.sidebar + "<br />");
for (x in window.sidebar) {
    document.write("<b>" + x + " :</b> " + window.sidebar[x] + "<br />");
}
// ]]></script>

window.statusbar

Property Type Value
statusbar BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.statusbar + "<br />");
for (x in window.statusbar) {
    document.write("<b>" + x + " :</b> " + window.statusbar[x].toSource() + "<br />");
}
// ]]></script>

window.toolbar

Property Type Value
toolbar BarProp
Property Type Value
object BarProp
visible Boolean
<script>// <![CDATA[
document.writeln(window.toolbar + "<br />");
for (x in window.toolbar) {
    document.writeln("<b>" + x + " :</b> " + window.toolbar[x] + "<br />");
}
// ]]></script>

window.top

Property Type Value
top Window
<script>// <![CDATA[
document.writeln(window.top+ "<br />");
for (x in window.top) {
    document.writeln("<b>" + x + " :</b> " + window.top[x] + "<br />");
}
// ]]></script>

window.window

Property Type Value
window Window
<script>// <![CDATA[
document.writeln(window.window + "<br />");
for (x in window.window) {
    document.write("<b>" + x + " :</b> " + window.window[x] + "<br />");
}
// ]]></script>

References

Faulkner, Steve, et al. “HTML 5.1”. W3C Working Draft. World Wide Web Consortium (W3C). June 2, 2016.

Hickson, Ian, et al. “HTML5: A vocabulary and associated APIs for HTML and XHTML”. W3C Recommendation. World Wide Web Consortium (W3C). October 28, 2014.

Kacmarcik, Gary, et al. “UI Events Specification”. W3C Working Draft. World Wide Web Consortium (W3C). December 15, 2015.

Pieters, Simon.“CSSOM View Module”. Editor’s Draft. World Wide Web Consortium (W3C). June 14, 2016.

Leave a Reply