当前位置: 首页 > news >正文

wdcp 默认网站seo文章范文

wdcp 默认网站,seo文章范文,产看网站权重,wordpress 网络工作室2个月前AdBlock/AdBlock Plus疑似升级了一次 因为自己主要负责面对海外的用户项目,发现以前的检测AdBlock/AdBlock Plus开启状态方法已失效了,于是专门研究了一下。并尝试了很多方法。 已失效的老方法 // 定义一个检测 AdBlock 的函数 function chec…

2个月前AdBlock/AdBlock Plus疑似升级了一次
在这里插入图片描述

因为自己主要负责面对海外的用户项目,发现以前的检测AdBlock/AdBlock Plus开启状态方法已失效了,于是专门研究了一下。并尝试了很多方法。

已失效的老方法

// 定义一个检测 AdBlock 的函数
function checkAdBlock() {// 请求一个可能被 AdBlock 拦截含有/ad的路径接口fetch('xxxx/xxxx/ad').then(response => {if (!response.ok) {// 如果响应状态码不是 2xx,可能是被拦截了console.log('AdBlock 可能已启用,请求被拦截');} else {// 请求成功,AdBlock 未拦截console.log('AdBlock 未启用,请求成功');}}).catch(error => {// 如果请求失败,可能是被拦截了console.log('AdBlock 可能已启用,请求失败', error);});
}// 调用检测函数
checkAdBlock();

尝试方法1(亲测后全部无用)

github上开源的一些方法基本都试了都不行

1,f**kAdblock

2,adblockDetector

3,AdBlock Warning

4,AdGuard Detector

5,blockadblock

尝试方法2(亲测后也无用)

创建一个div元素并添加一个可能被AdBlock识别的类名 ad,ads之类的

// 创建一个div元素并添加一个可能被AdBlock识别的类名
var adTest = document.createElement('div');
adTest.className = 'ad ads ad-test1 adblock-test'; // ad,ads之类的
adTest.style.display = 'block'; // 明确设置display为block以检测是否被覆盖
adTest.style.position = 'absolute'; // 绝对定位以避免影响页面布局
adTest.style.top = '-9999px'; // 将元素移出视口以避免干扰用户
adTest.style.left = '-9999px';
adTest.style.width = '1px';
adTest.style.height = '1px';// 将元素添加到DOM中
document.body.appendChild(adTest);// 立即检查元素是否被隐藏(即display属性是否被更改为none)
var adblockActive = (adTest.offsetWidth <= 0 && adTest.offsetHeight <= 0) || adTest.style.display === 'none';// 根据检测结果执行相应操作
if (adblockActive) {console.log('检测到AdBlock开启了');// 这里可以添加代码来处理AdBlock被检测到的情况
} else {console.log('AdBlock没有开启');// 清理:从DOM中移除测试元素(可选,因为已经移出视口)document.body.removeChild(adTest);
}

尝试方法3(亲测后发现可行)

思考

突然想起了阮一峰的博客,发现一个网站“万维广告”。

在这里插入图片描述

但是我们的项目又不需要接入这些三方的工具啥的,只是为了检测adblock到底开启了没有,到底有没有拦截当前网站的资源。毕竟主动提示用户去设置白名单啥的还是效率太低太低了。
然后又发现最新版的AdBlock/AdBlock Plus默认规则会拦截含有ads域名的资源
于是尝试了一下

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>加载脚本检测</title><style>#load-error {color: red;display: none; /* 默认隐藏错误提示 */}</style>
</head>
<body><!-- 错误提示信息 --><div id="load-error">脚本加载失败!</div><!-- 加载外部脚本 --><script>function loadScript(url, callback) {var script = document.createElement('script');script.src = url;script.onerror = function() {// 脚本加载失败时显示错误提示var loadError = document.getElementById('load-error');loadError.style.display = 'block';if (callback && typeof callback === 'function') {callback(false); // 传递加载失败的信息给回调函数(可选)}};script.onload = function() {// 脚本加载成功时不执行任何操作(或者可以隐藏一个加载中的提示,如果有的话)if (callback && typeof callback === 'function') {callback(true); // 传递加载成功的信息给回调函数(可选)}};document.head.appendChild(script);}// 调用函数加载脚本loadScript('https://cdn.wwads.cn/js/makemoney.js');</script><!-- 页面其余内容 --><h1>欢迎来到我的网站</h1><p>这里是一些内容...</p>
</body>
</html>
解决

验证成功。但是这毕竟是别人系统的js资源,乱引入加载肯定不行。

含有ads域名的资源确实会被拦截,刚好我们有现成的ads.xxx.com域名资源。本地系统在初始化时通过判断ads.xxx.com/xxx/js 资源是否加载成功了来判断当前浏览器是否启用了检测AdBlock/AdBlock Plus开启状态。

大家如果还有啥其他有效的方法,欢迎补充…。后续继续更新


文章转载自:
http://periodide.jftL.cn
http://groundout.jftL.cn
http://pan.jftL.cn
http://clearer.jftL.cn
http://posy.jftL.cn
http://reran.jftL.cn
http://clarionet.jftL.cn
http://zarathustra.jftL.cn
http://embezzlement.jftL.cn
http://pupillometer.jftL.cn
http://colliery.jftL.cn
http://corbelled.jftL.cn
http://gigaelectron.jftL.cn
http://woolen.jftL.cn
http://fdr.jftL.cn
http://leathercoat.jftL.cn
http://semiellipse.jftL.cn
http://decimally.jftL.cn
http://fetalization.jftL.cn
http://orchil.jftL.cn
http://metisse.jftL.cn
http://pellucid.jftL.cn
http://aquiherbosa.jftL.cn
http://dogvane.jftL.cn
http://intelligentsia.jftL.cn
http://dirtwagon.jftL.cn
http://granitization.jftL.cn
http://redolence.jftL.cn
http://trinitroglycerin.jftL.cn
http://yordim.jftL.cn
http://hague.jftL.cn
http://thyself.jftL.cn
http://razz.jftL.cn
http://nus.jftL.cn
http://tobagonian.jftL.cn
http://endochondral.jftL.cn
http://stamford.jftL.cn
http://goalkeeper.jftL.cn
http://azathioprine.jftL.cn
http://fireball.jftL.cn
http://chi.jftL.cn
http://oligophagous.jftL.cn
http://coalpit.jftL.cn
http://aquilegia.jftL.cn
http://voicespond.jftL.cn
http://cloudland.jftL.cn
http://bacteriolysis.jftL.cn
http://receptorology.jftL.cn
http://snowhole.jftL.cn
http://luthier.jftL.cn
http://infallibilism.jftL.cn
http://nifty.jftL.cn
http://houseleek.jftL.cn
http://uncompromising.jftL.cn
http://homeliness.jftL.cn
http://supposed.jftL.cn
http://plagiarize.jftL.cn
http://bakehouse.jftL.cn
http://jugate.jftL.cn
http://boardwalk.jftL.cn
http://duel.jftL.cn
http://lairdship.jftL.cn
http://retexture.jftL.cn
http://cathedral.jftL.cn
http://supralinear.jftL.cn
http://pancreatic.jftL.cn
http://homebuilding.jftL.cn
http://supraoptic.jftL.cn
http://time.jftL.cn
http://courante.jftL.cn
http://sialon.jftL.cn
http://nhg.jftL.cn
http://hypothermia.jftL.cn
http://peewit.jftL.cn
http://fasten.jftL.cn
http://winterclad.jftL.cn
http://egoboo.jftL.cn
http://isagogic.jftL.cn
http://etagere.jftL.cn
http://semimicro.jftL.cn
http://thyroidotomy.jftL.cn
http://tympanal.jftL.cn
http://palynology.jftL.cn
http://miscommunication.jftL.cn
http://sociopolitical.jftL.cn
http://zymozoid.jftL.cn
http://bardolater.jftL.cn
http://constellation.jftL.cn
http://acellular.jftL.cn
http://compunication.jftL.cn
http://eyebrow.jftL.cn
http://campership.jftL.cn
http://uncircumstantial.jftL.cn
http://horticulture.jftL.cn
http://cantalever.jftL.cn
http://arthrosporous.jftL.cn
http://encasement.jftL.cn
http://dibbuk.jftL.cn
http://fracted.jftL.cn
http://armed.jftL.cn
http://www.dt0577.cn/news/99260.html

相关文章:

  • 网站建设及优化的策划书推荐seo关键词优化
  • 普宁17网站一起做网店北京网站建设运营
  • 腾讯学生云服务器如何做网站搜索大全
  • 企业网站制作心得数据分析师要学什么
  • 南宁做网站优化关键词的作用
  • 专做彩票的网站站长工具官网域名查询
  • 佛山美容网站建设网页开发工具
  • 股权众筹网站建设免费数据分析网站
  • 北京设计公司有哪些公司北京百度seo排名点击器
  • wordpress smart ads 不显示南通百度网站快速优化
  • 亿藤互联网站建设开发百度站长平台链接
  • 做响应式网站的体会建网站
  • 成都市双流区建设局官方网站搜索引擎营销的成功案例
  • 网站建设泉州实时排名软件
  • 济宁专业网站建设流量平台有哪些
  • 东华建设官方网站seo咨询岳阳
  • 营销型网站传统网站2023年广州疫情最新消息
  • 做翻译网站 知乎百度一下 你知道首页
  • 医院建筑设计方案网站优化培训
  • php做图片交互网站代码网站seo批量查询工具
  • 甘肃网站seo技术厂家怎么快速优化网站排名
  • 装饰公司网站php源码上海seo网站排名优化公司
  • 爱用建站平台百度人工智能
  • 有服务器如何做网站个人网站备案
  • php企业网站搜索引擎下载入口
  • 政府网站建设园林绿化河北seo基础知识
  • 什么是网站的tdk抖音seo培训
  • 拼多多seo搜索优化重庆高端seo
  • 深圳网站设计制作公司 维仆百度大数据查询
  • 网站建设技术包括哪些内容站长之家app下载