admin管理员组文章数量:1278820
I have an iframe that loads on someone else's page. When the iframe is closed I would like to refresh the parent page.
I currently employ a hash hack similar to what's described here: Close iframe cross domain
This method gives security problems in IE9 though, so I'm still looking for better solutions or an IE workaround..
Any ideas?
Related: IFrame on unload refresh parent page
I have an iframe that loads on someone else's page. When the iframe is closed I would like to refresh the parent page.
I currently employ a hash hack similar to what's described here: Close iframe cross domain
This method gives security problems in IE9 though, so I'm still looking for better solutions or an IE workaround..
Any ideas?
Related: IFrame on unload refresh parent page
Share Improve this question edited May 23, 2017 at 12:06 CommunityBot 11 silver badge asked Apr 23, 2012 at 16:15 AlexAlex 6941 gold badge8 silver badges33 bronze badges 1- 1 same question here stackoverflow./q/3800309/1157322 – svassr Commented Jul 9, 2012 at 15:03
1 Answer
Reset to default 10I think the only reliable way is to use postMessage in modern browsers for cross-domain munication, have not tested it but check this code part out... of course this only works if the "someone else's page" is somehow changeable
so inside if your page you do:
var parent = window.parent;
if (parent && parent.postMessage) {
parent.postMessage("closed");
}
on the other persons page:
window.onmessage = function(event) {
if (event.data === "closed") {
location.reload();
}
};
本文标签: javascriptClose iframe and refresh parent cross domainStack Overflow
版权声明:本文标题:javascript - Close iframe and refresh parent cross domain - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741261776a2367758.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论