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 »
Definition and Usage
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 object | The Window object itself. |
Browser Support
window.self
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |