简体   繁体   English

在野生动物园中从子iframe重新加载或重定向父项

[英]Reloading or redirecting the parent from a child iframe in safari

I am generating an iFrame that following some processing with the frame (from an external site) redirects back to my domain (within the iframe), which should then reload the parent frame. 我正在生成一个iFrame,在对框架进行一些处理之后(从外部站点),该iFrame会重定向回我的域(在iframe中),然后该域应重新加载父框架。 However I've tried multiple ways of calling the parent, but none of them seem to work in safari? 但是,我尝试了多种调用父级的方法,但是它们似乎都无法在野生动物园工作吗?

methods use include. 方法使用包括。

self.parent.location="/";
self.top.location="/";
self.top.location.reload();

all of these just reload the iframe. 所有这些都只是重新加载iframe。 it feels like it is losing the parent / top reference due to the redirects within the iframe. 感觉由于iframe中的重定向而丢失了父/顶部引用。

Actually I've encountered this problem before and I believe the root of the issue is that this is a browser-security related issue. 实际上,我以前曾遇到过此问题,并且我相信问题的根源在于这是与浏览器安全性相关的问题。 Try this -- it worked for me: 试试这个-对我有用:

var reloadParent = self.parent.location.reload();;
setTimeout("reloadParent", 500);

Hope this works for you. 希望这对您有用。

这行不通吗?

parent.parent.location.reload(true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM