0

这个问题是相关的网站浏览。并屏蔽一些广告。

我正在使用 Mozilla firefox 并安装了“无脚本”广告块扩展。它锁定了我想要的所有广告。现在我注意到一些网站在他们的网页中嵌入了一些 javascript,这些 javascript 检测到浏览器 firefox 或 Chrome 中安装的任何扩展,然后重定向到特定的自定义页面,上面写着请禁用您的 Adblock 脚本/扩展。

就像我从http://uptobox.com下载文件一样,今天它会将我重定向到自定义 html 页面http://uptobox.com/pages/adblock.html

做重定向的脚本在这个网站的网页源中。

    <script type="text/javascript">
    //alert(document.getElementById("m10i6ekyhkf1").style.height);
    //alert(document.getElementById("m10i6ekyhkf1").clientHeight);
    // Missclick !
    setTimeout(function() {
            if (document.getElementById("m10i6ekyhkf1").clientHeight < 11 || document.getElementById("m10i6ekyhkf1").style.position == "absolue") {
                    document.writeln("Redirection...!");
                    window.location = "/pages/adblock.html";
                    document.getElementById("container-page").innerHTML = '<div class="informations middle-content"><span class="server_name">You are using adblock plus or something else which block advertising!</span><br /><br />Uptobox can only exist today thanks to advertising.<br />Indeed, <b>advertising is one of our biggest income to paid our bandwidth and servers</b>, because our service is mainly free !<br />This is why we ask you to allow ads on Uptobox to use our service !<br />If you haven\'t got an adblocker, you can try to disable your antivirus.<br />(If you have any other issue, please empty your cache and refresh your link)<br /><br />\';<div class="debrid_case"><br /><span class="server_name"><center>Disable adblock</center></span><div style="text-align: center; margin-top: 15px;"><img src="http://uptobox.com/image_default/disableadblock.png" style="border: 5px solid #CFCFCF;" /></div><div style="text-align: center; margin-top: 15px;">You only have to click on "Disable Adblock Plus" <br />or "Disable adblock plus on uptobox.com"</div></div></div>';
            }

            $('.page-top').html($('.page-top').html() + " ");
            $('.file-name').html($('.file-name').html() + " ");


            if ($('.page-top').text().length > 70) {
              var tmp_txt = $('.page-top').html().substr(0, 70);
              $('.page-top').html(tmp_txt);
              $('.page-top').append('...');
            }
    },3000);
  if (window.location.protocol != "http:")
window.location.href = "http:" + window.location.href.substring(window.location.protocol.length);

无论如何我想停止这个脚本来重定向我或任何通过在我的浏览器中呈现页面来停止这个javascript的firefox模块/插件?

提前谢谢了

4

1 回答 1

0

你必须弄清楚这个脚本是如何检测广告拦截的。

此代码似乎没有像您建议的那样进行扩展检测。相反,它会检查.heightDOM 元素的 。这可能是广告将被加载的元素,如果您阻止广告脚本,则 DOM 元素将不会处于预期状态。

您无法检测到脚本尚未加载。您只能检测到它的预期效果尚未发生。在这种情况下,站点在检查前等待 3 秒。这是检测通用广告拦截器的一种非常合理的方法,而不仅仅是 Firefox 上的 adblock plus。


没有简单的解决方案可以阻止此站点重定向。也许您可以使用 Greasemonkey 来破解此代码。

一种方法是删除document.getElementById("m10i6ekyhkf1")元素,这将破坏脚本并阻止重定向。

于 2014-04-02T16:49:37.087 回答