如何欺骗/欺骗iframe以将其视为DOM中的TOP元素 [英] How to Trick/Fool an Iframe to thinking its the TOP element in DOM

查看:326
本文介绍了如何欺骗/欺骗iframe以将其视为DOM中的TOP元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了这个框架破坏代码,现在为了好玩,我想破坏它。
此代码显示在iframe页面中:

 (function(){
if(window!=顶部){
//下面的iframe:
top.location.replace(location);
}
})();

它会从iframe中消失。



我根本不想改变这个代码,但是我想要一个解决方法代码放在这个iframe的PARENT中,这样iframe就无法检测到它的iframe,从而使这个破坏帧的代码无效。 / p>

换句话说,我如何让iframe认为它是顶部窗口(意思是窗口==顶部)
任何解决方法都表示赞赏!

解决方案

这本身并不存在,但是有许多技术可以禁用常见的framebustin技术的效果 - 其中一种可以是了解此处



通过使用 onunloadevent 通过将其位置设置为文件返回来取消网址重定向状态代码为204。


I've created this frame busting code, and now for fun, I want to bust it. This code appears inside an iframe page:

(function() {
 if (window!=top) {
//Bust out of iframe below:
 top.location.replace(location);
 }
})();

And it busts out of the iframe.

I do not want to alter this code at all, but I want a workaround code to put in the PARENT of this iframe, so that the iframe can't detect that its an iframe, thus invalidating this frame-busting code.

In other words, how do I make the iframe think that it IS the top window (meaning window==top) Any workaround is appreciated!

解决方案

This is not in itself possible, but there are a number of techniques for disabling the effect of common framebustin techniques - one of them can be read about here.

It works by using the onunloadevent to 'cancel' the url-redirection by setting its location to a document returning a status code of 204.

这篇关于如何欺骗/欺骗iframe以将其视为DOM中的TOP元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆