将页面保留在iframe中 [英] Keeping pages inside an iframe
问题描述
我正在尝试将网站放在iframe中,但网站上的此代码会不断更改页面的窗口。无论如何我可以解决这个问题吗?或者更好的是,我可以在iframe中禁用javascript吗?
I am trying to put a website inside an iframe, but this code on the site keeps changing the window of the page. Is there anyway I can get around this? Or better yet, can I disable javascript in an iframe?
if(top!=self){
if(top.location)
top.location=self.location;
else
top.location='http://example.com/not_subframe.html';
}
推荐答案
是的,有可能,那里有几种反框架破坏方法,包括在框架中禁用JS(沙盒,designMode)。所有这些都在 OWASP:Defending_with_Frame_Breaking_Scripts 的限制中进行了描述。
Yes it is possible, there are several methods of anti-frame busting including disabling JS in a frame (sandboxing, designMode). All described in Limitations of OWASP:Defending_with_Frame_Breaking_Scripts.
通常仅在内联网或受限访问站点使用它。如果您公开使用此类技巧公开网站,您可能会被Google或其他人列入黑名单。
Generally use it only with intranet or restricted access site. If you expose site publicly with such tricks you may expect blacklisting by Google or others.
这篇关于将页面保留在iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!