Window self Property

Definition and Usage

self The property returns the current window.

self The property is read-only.

Tip:self Properties are often used for comparison (see the examples below).

Instance

Is this window the topmost window:

if (window.top != window.self) {
  text = "This window is NOT the topmost window!";
} else {
  text = "This window is the topmost window!";
}

Try it yourself

Syntax

window.self

Return Value

Type Description
Object The Window Object Itself.

Browser Support

All Browsers Support window.self:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support