检测"错误106 net :: ERR_INTERNET_DISCONNECTED)"

tra*_*ble 6 google-chrome google-chrome-extension

无论如何在Chrome显示页面时检测到后台扩展程序"错误106(net :: ERR_INTERNET_DISCONNECTED):Internet连接已丢失." ?我试图注册既具有侦听chrome.webRequest.onErrorOccurred.addListenerchrome.webNavigation.onErrorOccurred.addListener但当"错误106"出现既不监听器被调用.正在为其他错误正确调用我的侦听器,例如"net :: ERR_NAME_NOT_RESOLVED".

我在Window 7环境中瞄准Chrome 22.0.1229.94.更大的目标是在Internet连接丢失时提供自定义消息传递(在单独的选项卡中).

Fra*_*rmu 3

我个人最终测试了响应==“”和状态==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;
Run Code Online (Sandbox Code Playgroud)