MDN Web Docs

Value

A WindowProxy object.

Examples

Uses of window.self like the following could just as well be replaced by window.

js

if (window.parent.frames[0] !== window.self) {
  // this window is not the first frame in the list
}

Furthermore, when executing in the active document of a browsing context, window is a reference to the current global object and thus all of the following are equivalent:

js

const w1 = window;
const w2 = self;
const w3 = window.window;
const w4 = window.self;
// w1, w2, w3, w4 all strictly equal, but only w2 will function in workers

Specifications

Specification
HTML
# dom-self-dev

Browser compatibility

See also

Help improve MDN

Yes No

Learn how to contribute

This page was last modified on by MDN contributors.

Read the original on developer.mozilla.org ↗