【发布时间】:2013-06-11 17:11:27
【问题描述】:
我有一个包含 iframe 的页面,该 iframe 会打开一个弹出窗口。
提交表单后,此弹出窗口应关闭并重新加载打开它的 iframe。
弹窗关闭并通过这种方式重定向:
window.opener.location.href = "http://www.myweb.com/iframe.php";
window.close ();
当我直接从 iframe 工作时,这对我有用,但是当我从包含 iframe 的页面执行此操作时,iframe 不会刷新。
那么...在这种情况下如何重新加载 iframe?
【问题讨论】:
-
更改其
src属性怎么样? (如果更改为相同的内容不起作用,请尝试在末尾添加?foo=bar或另一个缓存中断器。 -
您可以从父级更改 iframe 的 url 吗? [又名正文中包含 iframe 的页面?]
-
尝试
parent.window.close();或调用父parent.closec_click()中的函数,并在父页面中定义close_click函数。 -
iframe 是否与页面来自同一来源?也就是说,它们是否来自同一个域?
-
好吧,如果 iframe 的 DOM 与包含页面的来源不同,则无法访问它。
标签: javascript redirect iframe popup window.opener