PROPERTY:  Window::closed


This property is used to return a Boolean value that determines if a window has been closed. If it has, the value returned is true.

The following code opens a new window and then immediately closes it. The onClick event of the button then calls a function which uses the window.closed property to display the status (open or closed) of the window.

<INPUT TYPE="Button" NAME="winCheck" VALUE="Has window been closed?" onClick=checkIfClosed()>'','','toolbar=no,scrollbars=no,width=300,height=150')
newWindow.document.write("This is 'newWindow'")

function ifClosed() {
document.write("The window 'newWindow' has been closed")

function ifNotClosed() {
document.write("The window 'newWindow' has not been closed")

function checkIfClosed() {
if (newWindow.closed)

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information