The opener property

The opener property is used to reference the window that opened the current window. This property is often used in new windows opened with the open() method. This is helpful if you want to detect if the main window has been closed or not, using the closed property, and if you want to perform an action in the main window through the new one.

if (window.opener.closed)

In the above code, the closed property is added after the opener property in order to check whether the window that opened the current window has been closed.

Leave a Reply