admin管理员组文章数量:1313729
I am trying to have the user sign in through a popup window. When they click the link to the popup window which is a php variable they can sign in. When the window closes I want it to reload the page they were originally on (the parent page).
Here is the code on the signin.php page...
<body onunload="opener.location=('')">
But all this does is make the sign in page bee the page the user was on. I think I need to put something in the parentheses, but I can't figure out what goes there.
I am trying to have the user sign in through a popup window. When they click the link to the popup window which is a php variable they can sign in. When the window closes I want it to reload the page they were originally on (the parent page).
Here is the code on the signin.php page...
<body onunload="opener.location=('')">
But all this does is make the sign in page bee the page the user was on. I think I need to put something in the parentheses, but I can't figure out what goes there.
Share Improve this question edited Jul 9, 2012 at 23:10 Chris Baker 50.6k12 gold badges99 silver badges116 bronze badges asked Jul 9, 2012 at 23:07 John DoeJohn Doe 2,0609 gold badges33 silver badges54 bronze badges 2- 1 possible duplicate of Refreshing Parent window after closing popup – Chris Baker Commented Jul 9, 2012 at 23:16
- Why did someone -1 my ment??? – John Doe Commented Jul 9, 2012 at 23:20
2 Answers
Reset to default 6To reload a page, you can set the location property as the current value, like this:
window.location = window.location;
So for your case, you would use, literally:
onunload="window.opener.location = window.opener.location;"
You can also use the reload
method of the location
object:
onunload="window.opener.location.reload();"
This is the preferred method.
Also, please refer to the accepted answer for your previous question: Refreshing Parent window after closing popup
Documentation
window.location
on MDN - https://developer.mozilla/en/DOM/window.locationwindow.opener
on MDN - https://developer.mozilla/Talk:en/DOM/window.opener
echo '<script>window.opener.location.reload()</script>';
echo '<script>self.close()</script>';
It works well in all browsers.
本文标签: javascriptReload parent page after closing popup windowStack Overflow
版权声明:本文标题:javascript - Reload parent page after closing popup window - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741958840a2407148.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论