Is it possible to close opened window from within?
For example i have opened window with some external domain, t开发者_开发技巧hen it performs some auth and redirect back to my webpage.
Is it possible to close windows after that?
Thanks ;)
If you want to close the window that you're currently in, you can use the following code:
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.
精彩评论