Window closed property
Definition and Usage
closed property returns a Boolean value that declares whether the window has been closed.
grammar
window.closed
Browser Support
All major browsers support closed property
Examples
Examples
Detecting whether a new window "myWindow" has been closed:
function checkWin () {
if (! myWindow) {
document.getElementById ( "msg") innerHTML = "My window was not open!.";
}
else {
if (myWindow.closed) {
. Document.getElementById ( "msg") innerHTML = "My window was closed!";
}
else {
. Document.getElementById ( "msg") innerHTML = "My window is not closed!";
}
}
}
if (! myWindow) {
document.getElementById ( "msg") innerHTML = "My window was not open!.";
}
else {
if (myWindow.closed) {
. Document.getElementById ( "msg") innerHTML = "My window was closed!";
}
else {
. Document.getElementById ( "msg") innerHTML = "My window is not closed!";
}
}
}
try it"
Window object