There is a certain Chrome extension and I want to get a PNG file from it by XMLHttpRequest. If the extension is enabled, I want to write 'load' to the console, and if the extension is disabled, I want to write 'error' to the console.
It works fine, but if the Extension is disabled, Chrome writes an error in the console that I do not want to appear:
How can I remove this error from the console?
(I have tried window.onerror but it doesn't work)
The code:
var loadHref = function(href) {
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onload = function(){console.log('load')};
    xmlhttp.onerror = function() {console.log('error');};
    xmlhttp.open('GET', href);
    xmlhttp.send();
}
loadHref('chrome-extension://77672b238520494cba8855547dd00ba8/img/icon24.png');


 
     
     
    