Window closed
Example
A function to check if a window is closed:
function checkWin()
{
if (!myWindow) {
text = "It has never been opened!";
} else {
if (myWindow.closed) {
text = "It is closed.";
} else {
text = "It is open.";
}
}
}
Try it Yourself »
Definition and Usage
The closed property returns true if the window is closed.
The closed property is read-only.
Syntax
window.closed
Return Value
| Type | Description |
| A boolean | true if the window is closed,
otherwise false. |
Browser Support
window.closed is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | Yes |