Chrome扩展程序Web请求不会显示信息

时间:2016-06-29 00:40:23

标签: javascript google-chrome webrequest

我一直在寻找没有成功。 我想从我的扩展程序中获取我的请求状态,但我无法得到它。

Manifiest

    {
  "manifest_version": 2,

  "name": "Pixel Checker TT",
  "description": "This extension validate your pixels and its requests",
  "version": "1.6",

  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "background": {
    "persistent": true,
    "scripts": ["popup.js"]
  },
  "content_scripts": [
    {
      "matches": [
        "<all_urls>"
      ],
      "js": ["sources/js/jquery-3.0.0.min.js","content.js"]
    }
  ],
  "permissions": [
    "tabs",
    "activeTab",
    "webRequest",
    "webRequestBlocking",
    "*://*.mydomain.co/",
    "*://*.myotherdomain.co/"
  ]
}

popup.js或后台代码

 chrome.webRequest.onCompleted.addListener(function(details) {
            for (var i = 0; i < details.requestHeaders.length; ++i) {

                console.log(details.requestHeaders[i].url);
                console.log(details.requestHeaders[i].statusCode);
            }

        },
        {urls: ["<all_urls>"]},
        ['blocking','requestHeaders']);

问题是我没有错误只是没有打印信息。我还尝试将信息放在带有$(&#39;#pixelssound&#39;)的div中.text(details.requestHeaders [i] .url) 但也不起作用。

0 个答案:

没有答案