帧克星 [英] Frame buster buster

查看:76
本文介绍了帧克星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如这个问题所讨论的,我试图使用一个frame-buster-buster:
Frame Buster Buster ...需要使用代码

它在停止帧解析器方面效果很好,不幸的是它也停止了对网址 - 包括点击链接或在地址栏中输入新地址。



有没有办法解决这个问题?也许在加载框架后清除window.onbeforeunload函数?或者完全不同的方法?

解决方案

这就是我最终的目标。它只会在页面加载后忽略下一个重定向。这种方法的主要缺点是,如果框架从不调用其框架(例如,因为它没有正确加载,或者框架站点改变了它们的代码),这将停止下一次尝试的页面移动。一个可能的解决方案是在页面加载之后执行它,但是直接在任何脚本执行之前执行它。另一种解决方案是只捕获对框架主机的基本URL的URL更改。我不知道这是可能的,虽然...

  function ignore_next_redirect(){
var redirect_timer;
var prevent_bust = 0
window.onbeforeunload = function(){prevent_bust ++; }
redirect_timer = setInterval(function(){
if(prevent_bust> 0){
window.top.location ='http://example.org/204'
window.onbeforeunload = function(){}
clearInterval(redirect_timer);
}
},1);
}

它仍然有问题 - 它似乎停止加载内容,如果它发生在网页的开始。



我知道一个解决方案就在那里 - 谷歌的图像似乎有它的工作。将更新任何进度......


I'm trying to use a frame-buster-buster, as discussed in this question: Frame Buster Buster ... buster code needed

It works great at stopping the frame buster, unfortunately it also stops any change of the url at all - including clicking links or typing a new address in the address bar.

Is there any way around this? Maybe by clearing the window.onbeforeunload function after the frame has loaded? Or a completely different approach?

解决方案

This is what I ended up going with. It ignores only the next redirect after the page has loaded. The major downside of this method is that if the frame never calls its framebuster (e.g. because it doesn't load properly, or the framed site changes their code), this will stop the next attempted page movement. A possible solution would be to execute it after frame page load, but directly before any script executes. Another solution would be to only catch url changes to the framed host's base URL. I have no idea if that's possible though...

function ignore_next_redirect() {
  var redirect_timer;
  var prevent_bust = 0  
  window.onbeforeunload = function() { prevent_bust++; }  
  redirect_timer = setInterval(function() {  
    if (prevent_bust > 0) {  
      window.top.location = 'http://example.org/204'  
      window.onbeforeunload = function() {}
      clearInterval(redirect_timer);
    }  
  }, 1);
}

It still does have problems - it seems to stop loading content if it happens at the start of the page.

I know a solution is out there somewhere - google images seem to have got it working. Will update with any progress...

这篇关于帧克星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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