Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM Window closed Property

  • Last Updated : 26 Jul, 2019

The Window closed property in HTML DOM is used to return a value that indicates whether the referred window is closed or not.



Return Value: A Boolean value, true if window is closed otherwise false.


<!DOCTYPE html>
        HTML | DOM Window closed Property
        h2 {
            color: green;
        body {
            text-align: center;
        var gfgWindow;
        // function to open a window.
        function openWindow() {
            gfgWindow ="",
             "Window", "width=400, height=200");
        // function to close a window.
        function closeWindow() {
            if (gfgWindow) {
    alert("Window Closed");
    <h2>HTML | DOM Window closed Property</h2>
    <!--Click on Open Window to open a Window-->
    <button onclick="openWindow()">
        Open Window
    <!--Click on Close Window to close a Window-->
    <button onclick="closeWindow()">
        Close Window


  • Initial:
  • Window open:
  • Window close:

Supported Browsers: The browser supported by DOM Window closed Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!