Is there anyway to detect in a background extension when Chrome shows the page "Error 106 (net::ERR_INTERNET_DISCONNECTED): The Internet connection has been lost." ? I have tried registering a listener with both chrome.webRequest.onErrorOccurred.addListener
and chrome.webNavigation.onErrorOccurred.addListener
but neither listener is called when a "Error 106" occurs. My listeners are being called correctly for other errors such as "net::ERR_NAME_NOT_RESOLVED".
I'm targeting Chrome 22.0.1229.94 in a Window 7 environment. The larger goal is to provide custom messaging (in a separate tab) when Internet connectivity is lost.
I personally ended up testing for response == "" and status == 0.
var req = new XMLHttpRequest();
req.open("post", VALIDATE_URL, true);
req.onreadystatechange = function receiveResponse() {
if (this.readyState == 4) {
if (this.status == 200) {
console.log("We go a response : " + this.response);
} else if (!isValid(this.response) && this.status == 0) {
console.log("The computer appears to be offline.");
}
}
};
req.send(payload);
req = null;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With