Window closed property
- Previous page close()
- Next page confirm()
- Go back to the previous level Window Object
Definition and usage
If the window is closed, then closed
The property returns true
.
closed
The property is read-only.
See also:
Example
Function to check if the 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."; } } }
Syntax
window.closed
Return value
Type | Description |
---|---|
Boolean value | If the window is closed, it is true, otherwise it is false. |
Browser support
All browsers support window.closed
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous page close()
- Next page confirm()
- Go back to the previous level Window Object