Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

HTML | DOM Window closed Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 1
  • Edge 12
  • Internet Explorer 4
  • Firefox 1
  • Opera 12.1
  • Safari 1

My Personal Notes arrow_drop_up
Last Updated : 05 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials