开发者

Keeping pages inside an iframe

开发者 https://www.devze.com 2023-02-05 22:47 出处:网络
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 ifr

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/no开发者_开发知识库t_subframe.html';
}


You can only access the content of one frame from within another frame if both frames are from the same domain.

Otherwise this would be an XSS issue which is therefore forbidden by a browser.


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.

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.


Nope, can't be done. Not to mention it's usually a bad practice.


Web pages cannot disable JavaScript, if they could, it would be mayhem.


iFrames have a variety of security features to try to block what you're doing.

0

精彩评论

暂无评论...
验证码 换一张
取 消