English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window closed property

JavaScript Window Object

closedA read-only property indicating whether the referenced window is closed.

If the window is closed, this property returnstrue;If the window is already open, it returnsfalse.

Syntax:

window.closed
var x = document.getElementById("output");
function checkWindow() {
  if (!popupWindow) {
 x.innerHTML = "' popupWindow' Never opened!";
  } else {
 if (popupWindow.closed) { 
x.innerHTML = "' popupWindow' Already closed!";
 } else {
x.innerHTML = "' popupWindow' Not closed!";
 }
  }
}
Test See‹/›

Browser Compatibility

All browsers fully support the close property:

Property
closedYesYesYesYesYes

Technical Details

Return Value:Boolean value, true if the window is closed; false if the window is open

Related References

Window (Window) Reference:window.opener property

Window (Window) Reference:window.open() method

Window (Window) Reference:window.close() method

JavaScript Window Object