I'm making a call to a geolocation API:
$.ajax({
url: 'https://freegeoip.net/json/',
type: 'POST',
dataType: 'jsonp'
})
.done(function(location) {
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
adblockers appear to block this, and I get the error ERR_BLOCKED_BY_CLIENT
when adblocker is enabled. The problem is, it doesn't trigger either of the .done
, .fail
or .always
handlers. I'm wondering if there's a solution that will trigger on ERR_BLOCKED_BY_CLIENT
so that I can fail gracefully.
I could always execute a piece of code to see if a value was set after say 5 seconds, but I'd like something more complete.