从重定向父页面prevent IFRAME [英] prevent iframe from redirecting parent page
问题描述
这是这种情况:
我在同一个领域,我的网站里面的iframe。
目前,我得的iframe code无即时访问作为部署问题。
This is the situation: I have on the same domain, an iframe inside my web site. currently, I have no immediate access to the iframe code as of deployment issues.
在iframe中加载,它里面的code检测到的东西,触发父页面上的重定向。暂时,我想删除它。我知道我可以使用onbeforeload,但警告将显示在用户点击一个链接的任何每次
when the iframe loads, the code inside it detects something that triggers a redirection on the parent page. Temporarily, I want to remove it. I know I can use the onbeforeload, but a warning will be displayed every time the user click on a any link.
有没有一种方法,我可以检测重定向?在它发生之前主父页面完全加载。
Is there a way I can detect the redirection? it happens before the main parent page is fully loaded.
我GOOGLE了很多,但仍然没有有效的解决方案。
I googled it a lot but still have no working solution.
谢谢!
推荐答案
阅读的 w3.org SPEC 。我找到了另一种解决办法。
After reading the w3.org spec. I found another solution.
您可以设置沙盒=
,其中prevents的iframe重定向弗罗姆。话虽这么说,它也不会重定向iframe中。您将失去基本的点击。
You can set sandbox=""
, which prevents the iframe frome redirecting. That being said it won't redirect the iframe either. You will lose the click essentially.
例如,在这里: http://jsfiddle.net/ppkzS/1/ 结果
例如无沙箱: http://jsfiddle.net/ppkzS/
这篇关于从重定向父页面prevent IFRAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!