使用 javascript 动态创建的 iframe 不重新加载父 URL

发布于 2024-09-01 07:30:22 字数 797 浏览 0 评论 0原文

我似乎无法从 iframe 中重新加载父页面,即使我的 iframe 和父页面的域看起来相同。 IFRAME 是动态创建的,而不是在 HTML 页面源中创建的,所以这可能是问题所在吗?

登录后,我正在使用的 iframe 位于 http://www.avaline.com/ R3000_3

您可以使用 user:[email protected] 通过:test03

登录后,点击“订购样品”按钮,然后点击“此处”,其中显示“您的第三方托运人号码(要输入一个,请单击此处。)”。

我尝试使用 javascript 语句 window.top.location.reload(),window.parent.location.reload(),window.parent.location.href=window.parent.location.href 但这些语句在 FF 3.6 中都不起作用,所以我尽管我正在寻找跨浏览器解决方案,但没有转向其他浏览器。

我将一行 javascript 语句放入 setTimeout("statement",2000) 中,以便人们可以在重定向发生之前读取 iframe 的内容,但这不应该影响语句的执行...

我希望我可以测试并使用 Iframe 内的 Firebug 控制台调试语句。

I can't seem to reload the parent page from within an iframe even though the domain for my iframe and the parent page appear to be the same. The IFRAME was created dynamically, rather than in the HTML page source, so could that be the problem?

The iframe I'm working with is here http://www.avaline.com/ R3000_3 once you log in.

You may use user:[email protected]
pass: test03

Once logged in, hit the "order sample" button, and then hit "here" where it says "Your Third Party Shipper Numbers (To enter one, click here.)".

I tried using javascript statements window.top.location.reload(),window.parent.location.reload(),window.parent.location.href=window.parent.location.href but none of those worked in FF 3.6 so I didn't move on to the other browsers although I am shooting for a cross-browser solution.

I put the one-line javascript statements inside setTimeout("statement",2000) so people could read the content of the iframe before the redirect happens, but that shouldn't affect the execution of the statements...

I wish I could test and debug the statements with the Firebug console from within the Iframe.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷心人i 2024-09-08 07:30:22

您的脚本标记是:

这可能是问题所在:-)

如果将其更改为“text/javascript”则不会要解决问题,请尝试稍微更改查询字符串:

window.top.location.search = window.top.location.search + '&dc=' + (new Date).getTime();

Your script tag is:

<script type="test/javascript">

That might be the problem :-)

If changing that to "text/javascript" doesn't fix the issue, try changing the query string slightly:

window.top.location.search = window.top.location.search + '&dc=' + (new Date).getTime();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文