Window closed property
Window Object
Definition and Usage
The closed property returns a Boolean value that declares whether the window has been closed.
Syntax
window.closed
Browser support





All major browsers support the closed property
Example
Example
Check whether the new window "myWindow" has been closed:
function checkWin(){
if (!myWindow){
document.getElementById("msg").innerHTML="My window was not opened!";
}
else{
if (myWindow.closed){
document.getElementById("msg").innerHTML="My window was closed!";
}
else{
document.getElementById("msg").innerHTML="My window was not closed!";
}
}
}
Try it »
Window Object