window.closed

JavaScript1.1+, JScript1.0+ Nav3+, IE3+, Opera3+ Syntax

							window.closed

Description

The closed property of the Window object returns a Boolean value specifying if the window instance it is referencing is closed or not. If the window is still open, the property returns false. If it is closed, the property returns true.

Example

Listing 7.532 has two buttons. When the Open button is clicked, a second window is opened and focused. When the Check button is clicked, the script checks to see if the window is still open or not. If it is, the text in the text area of the second window is changed. If it is not, an alert dialog box is displayed.

Listing 7.532 Using the closed Property to See If a Window Is Still Open
 <html> <head> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.