简体   繁体   English

使用javascript动态创建的iframe不会重新加载父网址

[英]iframe created dynamically with javascript not reloading parent URL

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. 即使我的iframe和父页面的域似乎相同,我似乎也无法从iframe内重新加载父页面。 The IFRAME was created dynamically, rather than in the HTML page source, so could that be the problem? IFRAME是动态创建的,而不是在HTML页面源代码中创建的,那可能是问题所在吗?

The iframe I'm working with is here http://www.avaline.com/ R3000_3 once you log in. 登录后,我正在使用的iframe位于http://www.avaline.com/ R3000_3。

You may use user:test2@gmail.com pass: test03 您可以使用user:test2@gmail.com通过: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. 我尝试使用javascript语句window.top.location.reload(),window.parent.location.reload(),window.parent.location.href = window.parent.location.href但这些都不在FF 3.6中起作用,所以我尽管我正在寻找一种跨浏览器的解决方案,但并未继续使用其他浏览器。

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... 我将单行javascript语句放入setTimeout(“ statement”,2000)中,以便人们可以在重定向发生之前读取iframe的内容,但这不会影响语句的执行...

I wish I could test and debug the statements with the Firebug console from within the Iframe. 我希望可以在Iframe中使用Firebug控制台测试和调试语句。

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: 如果将其更改为“ text / javascript”不能解决问题,请尝试稍微更改查询字符串:

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

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

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