如何捕获chrome扩展中的错误503?

时间:2016-07-30 00:59:29

标签: google-chrome-extension http-post http-status-code-503 onerror

我想捕获Google Chrome中所有标签内的POST请求错误。

我使用以下代码块来观察扩展中onErrorOccurred的触发:

chrome.webRequest.onErrorOccurred.addListener(
    function(details) {
        console.log("xxxxx");
        console.log(details);
    },
    {urls: ["<all_urls>"]});

但遗憾的是,此代码无法观察到错误代码503.例如,我创建了以下页面,返回错误503.

http://mjza.rf.gd/index.php

我还测试了以下与WebNavegation类相关的代码,但它也不起作用:

https://developer.chrome.com/extensions/examples/api/webNavigation/basic.zip

如果有人可以帮助我,那就太棒了。

提前致谢。

0 个答案:

没有答案