HTML DOM closed Property
Complete Window Object Reference
Definition and Usage
The closed property returns a Boolean value that specifies whether the window has been closed.
Syntax
Example
The following example checks whether the new window has been closed:
<html>
<head>
<script type="text/javascript">
function ifClosed()
{
document.write("'myWindow' has been closed!")
}
function ifNotClosed()
{
document.write("'myWindow' has not been closed!")
}
function checkWin()
{
if (myWindow.closed)
ifClosed()
else
ifNotClosed()
}
</script>
</head>
<body>
<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>
<input type="button" value="Has 'myWindow' been closed?"
onclick="checkWin()">
</body>
</html>
|
Try-It-Yourself Demos
Check whether
the window has been closed
Complete Window Object Reference
|