【发布时间】:2019-04-02 15:49:53
【问题描述】:
我正在使用“adframe”库来检测 adblock,它工作得很好。
但是,我在通过 AJAX 加载内容的网页中遇到了问题。
如果访问者在启用了 adblock 的情况下进入此页面,则库会检测到它并且不会显示内容,但如果用户在禁用 adblock 的情况下进入此页面,则会显示内容并通过 AJAX 加载所有未来的内容无论用户在此页面上是否启用广告拦截,都会显示,这是我的问题。
我正在尝试在执行 AJAX 函数时检测同一 URL 中的广告拦截。
Bellow 是其中一项功能……是否可以检测到中间的广告拦截??
function action1(time,id_object)
{
if(time != -1){
$("#time_object").html(time);
time2 = time - 1;
id_object2 = id_object;
count = setTimeout('action1(time2,id_object2);', 1000);
}
else
{
if(id_object != 0)
{
clearTimeout(count);
$('#feedback').modal('show');
$.ajax({
async:true,
dataType: "html",
type: "POST",
data: {id_object: id_object},
contentType: "application/x-www-form-urlencoded",
url: "site/show_object.php",
beforeSend:function(){
$('#feedback').html(loading);
},
success:function(data){
$('#feedback').html(data);
count = setTimeout('webpage3()',60000);
},
timeout:20000,
error:function(){
location.href= 'webpage4';
}
});
return 0;
}
else
{
next();
}
}
}
【问题讨论】: