脚本化 iFrame 在当前页面而不是 iFrame 内加载内容
我试图将网页加载到 iFrame 中,同时将内容栏保留在顶部,但对于我尝试加载到 iFrame 中的某些页面,内容会加载,就像我导航到该页面一样。
我使用以下代码动态加载 iframe:
$('#my_iFrame').attr("src","http://www.nytimes.com/2010/03/26/opinion/26ryan.html");
看起来这些页面上有一个脚本,用于检查它是否正在加载到 iframe 中,如果是,则将 document.location 更改为其自己的 url。
有什么方法可以绕过这样的黑客攻击,以便我可以将该网站加载到 iFrame 中吗?也许有某种方法可以保护 window.location 的值?
I'm trying to load a webpage into an iFrame while keeping a content bar on top, but for some pages that I try to load into the iFrame the contents is loaded as if I navigated to that page.
I use the following code to dynamically load an iframe:
$('#my_iFrame').attr("src","http://www.nytimes.com/2010/03/26/opinion/26ryan.html");
It looks like there is a script on these pages that checks to see if it is being loaded into an iframe and changes the document.location to it's own url if so.
Is there any way around a hack like this so that I can load that site into an iFrame? Maybe some way to protect the value of window.location?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过谷歌搜索,我发现了这一点:
但是,如果它位于不同的域中,它似乎不起作用。
您可以尝试在同一域和不同域上的页面吗?
来源:http://www.steadyhealth.com/Web_Hosting_Anti_Frame_Breaker_solution_t53346.html
By Googling, I found this:
However, it seems it does not work if it is in a different domain.
can you try it for a page on same domain and a different domain?
source: http://www.steadyhealth.com/Web_Hosting_Anti_Frame_Breaker_solution_t53346.html