You are here: Reference > JavaScript > client-side > dialog > properties > closed (window)

closed property (window)

Browser support:
Returns a Boolean value that indicates whether the window is closed or not.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Boolean, one of the following values:
The window is open.
The window is closed.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the closed property:
    <script type="text/javascript">
        var testWindow = null;
        function OpenTestWindow () {
            if (!testWindow || testWindow.closed) {
                testWindow = ("", "testWindow", "width=250, height=150, left=10, top=10");

        function IsTestWindowClosed () {
            if (testWindow) {
                if (testWindow.closed) {
                    alert ("The test window is closed.");
                else {
                    alert ("The test window is opened.");
            else {
                alert ("The test window was never opened.");
    You can open a test window and test its closed state with the following buttons:
    <br />
    <button onclick="IsTestWindowClosed ();">Test the closed state</button>
    <br />
    <button onclick="OpenTestWindow ();">Open the test window</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content