Is it possible to close opened window from within?
For example i have opened window with some external domain, then it performs some auth and redirect back to my webpage.
Is it possible to close windows after that?
Thanks ;)
如果要关闭当前所在的窗口,可以使用以下代码:
self.close();
When you open the window, assign it to some variable:
authWindow = window.open("");
Then when you're done with it, you can close it:
authWindow.close()
var popupWindow = window.open(.....);
popupWindow.close();
var w = window.open(/*arguments*/);
Now w
is DOMWindow object.
w.opener === window; //true
w.close();
After that value of the opener
property is null
w.opener === null; //true
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.