In JS, Window.opener is just a reference to the pop-up window's parent window. Like what:
In A.html, window.open a new window b.html by clicking on a button. Then in b.html, we can use Window.opener (omit write as opener) to reference a.html, including a.html document and other objects, manipulate a.html content.
If this reference fails, then NULL is returned. Therefore, before calling the opener object, you must first determine whether the object is null, otherwise the "object is empty or does not exist" JS error.
Example
Opener.html
Copy Code code as follows:
<body>
<form name=form1>
<input Type=text Name=inpu >
<input Type=button onclick= "Javascript:window.open (' Back2opener.html?toname=opener.form1.inpu ');" >
</form>
</body>
back2opener.html
Copy Code code as follows:
<body>
<form name=form1>
<input Type=text Name=inpu >
<a class=under href=# onclick= "{opener.document.form1.inpu.value+= ' Sun Chao, ';}" > Add </a>
</form>
</body>
JS Code:
window.open ();
And when payment is successful, the payment platform needs to be closed to the successful interface, and the client loads the client to pay the Success page, JS code:
Window.opener.location.href=url;window.close ();