js判断当前网站是否开启了AdBlock广告拦截功能,如果开启AdBlock插件显示提示“为了支持本项目的长期发展,请将本网站加入广告拦截器的白名单。”,否则不显示!
function ABDetected(){
var adBlockDetected_div=document.createElement("div");
adBlockDetected_div.style.cssText="position: absolute; top: 0; left: 0; width: 100%; background: #fc6600; color: #fff; z-index: 9999999999; font-size: 14px; text-align: center; line-height: 1.5; font-weight: bold; padding-top: 6px; padding-bottom: 6px;";adBlockDetected_div.innerHTML="为了支持本项目的长期发展,请将本网站加入广告拦截器的白名单。";
document.getElementsByTagName("body")[0].appendChild(adBlockDetected_div);
var adBlockDetected_close=document.createElement("div");
adBlockDetected_close.style.cssText="position: absolute; top: 0; right: 10px; width: 30px; height: 30px; background: #fc6600; color: #fff; z-index: 9999999999; line-height: 30px; cursor: pointer;";
adBlockDetected_close.innerHTML="×";
adBlockDetected_div.appendChild(adBlockDetected_close);
adBlockDetected_close.onclick=function(){
this.parentNode.parentNode.removeChild(this.parentNode)
}
}
function docReady(t){
"complete"===document.readyState||"interactive"===document.readyState?setTimeout(t,1):document.addEventListener("DOMContentLoaded",t)
}
docReady(function(){
setTimeout(function(){
if(window._AdBlockInit===undefined){
ABDetected()
}
},3e3)
});
PouchDB:一款基于JavaScript 的开源NoSQL文档数据库
JavaScript获取指定网站状态码查询代码(2种实现方法)
上面是“js判断AdBlock广告是否开启拦截”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_13653.html
workflows工作流
雪地里一只可爱的小老虎
图片转视频ComfyUI工作流
一个表情深思熟虑的成熟男人
一只蚊子被嵌在琥珀中ComfyUI工作流
王家卫电视剧繁花海报效果comfyui工作流
一座巨大的野兽派建筑漂浮在热带风景中的贫民
一架令人难忘的美丽钢琴ComfyUI工作流
一个十几岁的美国女孩穿着黄色连帽衫在黑暗和空虚的背景下闲逛
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

css3实现星球旋转
css3绘制一个会动的大嘴鸟
barcode条形码/qrcode二维码兼容所有浏览器(含ie6/ie7/ie8)
利用js做一个炫酷音乐背景效果
iframe开发admin后台
jquery鼠标滑过图片边框特效(jquery.focus-follow插件)
做一个好玩的时钟翻牌效果
canvas空间文本射线













