JavaScript window.closed Property

You are Here:

JavaScript window.closed Property

The window.closed property indicates whether the referenced window is closed or not.

Note: This property is read-only.


HTML Online Editor
<!DOCTYPE html> <html> <body> <button onclick="myOpen()">Open Window</button> <button onclick="myClose()">Close Window</button> <button onclick="myFunction()">Check Status</button> <p id="point"></p> <script> var myWindow; var x = document.getElementById("point"); function myOpen(){ myWindow ="", "myWindow", "width=400, height=300"); } function myClose(){ myWindow.close(); } function myFunction(){ if(!myWindow) x.innerHTML = "'myWindow' has never been opened!"; else if(myWindow.closed) x.innerHTML = "'myWindow' has been closed!"; else x.innerHTML = "'myWindow' has been opened!"; } </script> </body> </html>



Return Values

trueThe window has been closed.
falseThe window is open.


Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author