Home > Article > Web Front-end > Detailed explanation of the use of js opener_javascript skills
In JS, window.opener is just a reference to the parent window of the pop-up window. For example: In
a.html, window.open opens a new window b.html by clicking a button. Then in b.html, you can reference a.html through window.opener (omitted and written as opener), including the document and other objects of a.html, and operate the content of a.html.
If this reference fails, null will be returned. Therefore, before calling the opener object, you must first determine whether the object is null, otherwise a JS error of "the object is empty or does not exist" will occur.
Example
opener.html