如何从 https 弹出窗口重新加载 http window.opener?
我有一个 http 窗口,它会打开一个安全弹出窗口以向第三方网站提交表单。弹出窗口关闭后,我想重新加载打开器,以便它反映表单提交的结果。
由于开启器和弹出窗口使用不同的协议(http 和 https),因此我无法以简单的方式(window.opener.location.reload())执行此操作。还有别的办法吗?我必须冒险尝试 JSONP 吗?
I have an http window which opens a secure popup to submit a form to a third party web site. After the popup is closed, I would like to reload the opener so that it reflects the results of the form submission.
Since the opener and the popup use different protocols (http and https), I can't do it in the straightforward way (window.opener.location.reload()). Is there another way? Do I have to venture into JSONP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
笨拙的方法:设置超时来检查打开的弹出窗口是否已关闭。
Kludgy way: set timeout to check if opened popup was closed.
我知道这是一个超级老的问题,但我找到了一个更好的方法来做到这一点: 跨文档消息传递:
在弹出窗口中(当然,如果您控制它,至少在最后一页),您需要这样做:
这将关闭弹出窗口,并且还允许您执行其他操作,例如通过 Ajax 更新数据或重新加载页面。
I know that this is a super old question, but I found a better way to do this: Cross-document messaging:
While from the pop up (of course if you control it, at least the last page) you need this:
This will close the popup, and allows you to do other stuff as well, like update data via Ajax or reload the page.