admin管理员组文章数量:1315792
I basically have a page which shows a "processing" screen which has been flushed to the browser. Later on I need to redirect this page, currently we use meta refresh and this normally works fine.
With a new payment system, which includes 3D secure, we potentially end up within an iframe being directed back to our site from a third party.
I need to be able to redirect from this page, either using javascript or meta-refresh, and bust out of the iframe if it exists.
Cheers!
(I have done busting out of iframes before but can't find my old code and a google search was useless, thought it was the perfect time to try Stackoverflow out!)
I basically have a page which shows a "processing" screen which has been flushed to the browser. Later on I need to redirect this page, currently we use meta refresh and this normally works fine.
With a new payment system, which includes 3D secure, we potentially end up within an iframe being directed back to our site from a third party.
I need to be able to redirect from this page, either using javascript or meta-refresh, and bust out of the iframe if it exists.
Cheers!
(I have done busting out of iframes before but can't find my old code and a google search was useless, thought it was the perfect time to try Stackoverflow out!)
Share Improve this question edited Nov 7, 2008 at 14:36 Ben Doom 7,8851 gold badge29 silver badges31 bronze badges asked Nov 7, 2008 at 10:24 Ben LynchBen Lynch 1892 gold badges2 silver badges12 bronze badges3 Answers
Reset to default 4So I added the following to my redirected pages. Luckily they have nothing posted at them so can be simply redirected. Also the use of javascript is ok as it is required to get to that point in the site.
<script type="text/javascript" language="javascript">
if (top.frames.length>0)
setTimeout("top.location = window.location;",100);
</script>
I'm doing something similar to keep an old site inside it's frameset:
<SCRIPT TYPE="text/JavaScript">
if (window == top){top.location.replace("/foo.html");}
</SCRIPT>
So to break out of the iframe, just change == to !=
I see that you're using setTimeout in your example. Is waiting to break out of the iframe a requirement, or would you rather it happen immediately?
if you are using javascript:
parent.document.location = "http://www.google."
and if you are using html:
<a href="http://www.google." target=_top >Google</a>
本文标签: htmlBusting out of an iframe using metarefresh or javascriptStack Overflow
版权声明:本文标题:html - Busting out of an iframe using meta-refresh or javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741990862a2409077.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论