A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/Window/closed below:

Window: closed property - Web APIs

Window: closed property

Baseline Widely available

The Window.closed read-only property indicates whether the referenced window is closed or not.

Value

A boolean value. Possible values:

Examples

The following example demonstrates how a popup window can change the URL of the window that opened it. Before attempting to change the URL, it checks that the current window has an opener using the window.opener property and that the opener isn't closed:

// Check that an opener exists and is not closed
if (window.opener && !window.opener.closed) {
  window.opener.location.href = "https://www.mozilla.org";
}

Note that popups can only access the window that opened them.

In this example the function refreshPopupWindow() calls the reload() method of the popup's location object to refresh its data. If the popup hasn't been opened yet or the user has closed it a new window is opened.

let popupWindow = null;

function refreshPopupWindow() {
  if (popupWindow && !popupWindow.closed) {
    // popupWindow is open, refresh it
    popupWindow.location.reload(true);
  } else {
    // Open a new popup window
    popupWindow = window.open("popup.html", "dataWindow");
  }
}
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4