Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to catch net::ERR_BLOCKED_BY_CLIENT?

So on our site we have various searches some of which work fine and return the appropriate results. A few of them however return the javascript error:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT when I search on my machine.

I have found out that issue is that I am running AdBlocker in Google Chrome and it is AdBlocker that is causing the problem. Now I know I could just turn AdBlocker off which is fine and I have, but is there a way for me to catch this error in javascript and report to the user why they are not getting any search results?

Ideally I am after something similar to a c# try/catch.

EDIT: OK, so after some digging around and being pointed in the right direction from the comments below I think I have deduced the issue, hopefully this will help others.

After having read this it looks like what I am trying to accomplish cannot be done using the version of jQuery we are currently running (1.10.x) so I guess the solution is to use a new version of jQuery (2.x) and see if I can catch the error

like image 775
ltw1991 Avatar asked Nov 10 '16 12:11

ltw1991


People also ask

What does “this webpage was blocked by an extension (err_blocked_by_client) ” mean?

You may encounter the “This webpage was blocked by an extension (ERR_BLOCKED_BY_CLIENT)” error on Windows 7/8/10. This annoying issue can be caused by the bookmark manager, Chrome extension as well as the outdated Chrome OS. In the next part, let’s see how to fix the “net:: ERR_BLOCKED_BY_CLIENT” error.

How to fix “requests to the server have been blocked by extension” error?

When you meet the “requests to the server have been blocked by an extension” error, you can try to browse in Incognito mode in Google Chrome. You need to click the three dots icon on the top right corner of Google Chrome.

What is error net::err_blocked_by_client?

An error named as net::err_blocked_by_client is a very fair notice which several individuals have faced while using the Chrome browser in your desktop. This usually appears on a particular website that you are interested in visiting. This error is a result of the several extensions which are installed on your Chrome browser.

What causes a request to be blocked on a website?

There are many levels a request can be blocked. The cause could be in the network transport layer, a proxy server or router between you and the server. It might also be something in the browser.


1 Answers

Unfortunately you cannot catch that error message specifically, but you can catch the error itself:

$.ajax({
  url: 'http://openx.net',
  dataType: 'json',
  success: function( data ) {
    console.log( "Success:", data);
  },
  error: function( data ) {
    console.log( "Error:", data);
  }
});

Chrome blocking ad call

Obviously the example isn't requesting JSON, but you can see that it fails and calls the error handler.

These errors are fired by Chrome when, for instance, a plugin like Adblock (as you mentioned) cancels a request.

like image 148
Perry Mitchell Avatar answered Sep 22 '22 02:09

Perry Mitchell