Window self Property

Example

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 »

Description

The self property returns the current window.

The self property is read-only.

Note

The self property is often used in comparisons (see example above).


Syntax

window.self

Return Value

Type Description
An objectThe Window object itself.

Browser Support

window.self is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.