获取“net::ERR_BLOCKED_BY_CLIENT"某些 AJAX 调用出错 [英] Getting "net::ERR_BLOCKED_BY_CLIENT" error on some AJAX calls

查看:37
本文介绍了获取“net::ERR_BLOCKED_BY_CLIENT"某些 AJAX 调用出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我意识到,一些 adblocker 扩展(例如 adBlocker plus)会阻止一些 Ajax 调用.我在控制台上收到该错误:

Recently I've realised that, some adblocker extensions (such as adBlocker plus) block some Ajax calls. I get that error on the console:

GET http://localhost/prj/conn.php?q=users/list/ net::ERR_BLOCKED_BY_CLIENT 

为什么它会阻止某些 Ajax 调用而不是其他调用,这是什么原因造成的?除了告诉用户关闭广告拦截器之外,还有其他解决方法吗?

Why does it block some Ajax call but not the others and what causes that? Is there any workaround other than telling user to turn off adblocker?

推荐答案

AdBlockers 通常有一些规则,即它们将 URI 与某种类型的表达式进行匹配(有时它们也会将 DOM 与表达式进行匹配,但在这种情况下这并不重要)).

AdBlockers usually have some rules, i.e. they match the URIs against some type of expression (sometimes they also match the DOM against expressions, not that this matters in this case).

仅对一小部分文本(URI)进行操作的规则和表达式很容易产生一些误报...

Having rules and expressions that just operate on a tiny bit of text (the URI) is prone to create some false-positives...

除了指示您的用户禁用他们的扩展程序(至少在您的网站上)之外,您还可以获取扩展程序并测试哪些规则/表达式阻止了您的内容,前提是扩展程序提供了足够的详细信息.一旦确定了罪魁祸首,您可以尝试通过使用不同的 URI 来避免触发规则,向创建它的团队报告规则不正确或过于宽泛,或两者兼而有之.查看文档以了解如何执行此操作的特定附加组件.

Besides instructing your users to disable their extensions (at least on your site) you can also get the extension and test which of the rules/expressions blocked your stuff, provided the extension provides enough details about that. Once you identified the culprit, you can either try to avoid triggering the rule by using different URIs, report the rule as incorrect or overly-broad to the team that created it, or both. Check the docs for a particular add-on on how to do that.

例如,AdBlock Plus 有一个可阻止项目视图,显示页面上所有被阻止的项目以及触发阻止的规则.这些项目还包括 XHR 请求.

For example, AdBlock Plus has a Blockable items view that shows all blocked items on a page and the rules that triggered the block. And those items also including XHR requests.

这篇关于获取“net::ERR_BLOCKED_BY_CLIENT"某些 AJAX 调用出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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