在某些 AJAX 调用中出现“net::ERR_BLOCKED_BY_CLIENT”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23341765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 10:25:02  来源:igfitidea点击:

Getting "net::ERR_BLOCKED_BY_CLIENT" error on some AJAX calls

ajaxgoogle-chrome-extensionfirefox-addon

提问by s.alem

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

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

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

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?

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

回答by nmaier

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).

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

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.

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

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

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

Blockable items

可阻挡的物品

回答by ShapCyber

If your URL contains words such as "advert", "ad", "doubleclick", "click", or something similar…

如果您的 URL 包含诸如“advert”、“ad”、“doubleclick”、“click”或类似的词……

For example:

例如:

  • GET googleads.g.doubleclick.net/pagead/id
  • static.doubleclick.net/instream/ad_status.js
  • GET googleads.g.doubleclick.net/pagead/id
  • static.doubleclick.net/instream/ad_status.js

…Then ad-blocker will block it.

...然后广告拦截器将阻止它。

回答by Bill_VA

I've discovered that if the filename has 300in it, AdBlock blocks the page and throws a ERR_BLOCKED_BY_CLIENTerror.

我发现如果文件名包含300在其中,AdBlock 会阻止页面并引发ERR_BLOCKED_BY_CLIENT错误。

回答by bvanlew

Add PrivacyBadgerto the list of potential causes

PrivacyBadger添加 到潜在原因列表中

回答by MichaelMao

I find a case is if your url contains the key word "banner", it will blocked too.

我发现一种情况是,如果您的网址包含关键字“横幅”,它也会被阻止。

回答by Chetabahana

As it has been expained here, beside of multiple extensionsthat perform ad or script blocking you may aware that this may happen by file namesas below:

正如这里所解释的,除了执行广告或脚本拦截的多个扩展名外,您可能会意识到这可能是由文件名发生的,如下所示:

Particularly in the AdBlock Plusthe character string "-300x600" is causing the Failed to Load Resource ERR_BLOCKED_BY_CLIENT problem.

特别是在AdBlock Plus 中,字符串“ -300x600”导致无法加载资源 ERR_BLOCKED_BY_CLIENT 问题。

As shown in the picture, some of the images were blocked because of the '-300x600' pattern in their name, that particular text pattern matches an expression list pattern in the AdBlock Plus.

如图所示,一些图像因为名称中的“-300x600”模式而被屏蔽,该特定文本模式与 AdBlock Plus 中的表达式列表模式相匹配

ERR_BLOCKED_BY_CLIENT problem

ERR_BLOCKED_BY_CLIENT 问题

回答by Владимир Ефанов

Opera Blocker and others check all files/urls in Network. Then compares to the list. It is EasyPrivacy and EasyList. If your file/url in this, your will be ban. Good luck.

Opera Blocker 和其他人检查网络中的所有文件/网址。然后与列表进行比较。它是 EasyPrivacy 和EasyList。如果您的文件/网址在,您将被禁止。祝你好运。

So... I find FilterListsfor all addBlockers!

所以...我找到了所有 addBlockers 的FilterLists

回答by Jan

In my case it was a Chrome extension and Firefox add-on by Avira called "Avira Browser Safety". I had problems with version 1.7.4. In my specific case I wanted to login to a website called gliffy.comfor making diagrams, but after logging in I got an blank page. If you use F12 (console) in Chrome you can see all these ERR_BLOCKED_BY_CLIENT (and other) errors.

就我而言,它是 Avira 的 Chrome 扩展程序和 Firefox 附加组件,称为“Avira Browser Safety”。我在 1.7.4 版上遇到了问题。在我的特定情况下,我想登录一个名为gliffy.com的网站来制作图表,但登录后我得到了一个空白页面。如果您在 Chrome 中使用 F12(控制台),您可以看到所有这些 ERR_BLOCKED_BY_CLIENT(和其他)错误。