没有开发工具就可以获得HAR

时间:2013-08-04 03:33:02

标签: google-chrome-extension

如何在没有开发工具的情况下获得HAR?当我尝试使用此代码时,我发现了这个错误:

 chrome.devtools.network.getHAR(function(result) {
    var entries = result.entries;
    if (!entries.length) {
        Console.warn("Recarregue a pagina, ou inicie o stream");
    }

    for (var i = 0; i < entries.length; ++i) {
        console.log(entries[i]);
    }
});

错误:

Uncaught TypeError: Cannot call method 'getHAR' of undefined 

我将此代码放入background.js

清单:

{
    "name": "Download Stream",
    "version": "1.0",
    "minimum_chrome_version": "10.0",
    "description": "Efetua o download do stream",
    "background": { "scripts": ["background.js"] },
    "page_action" :
    {
        "default_icon" : "icon-19.png",
        "default_title" : "Download Stream"
    },
    "permissions": [
        "tabs",
        "http://*/*",
        "https://*/*"
    ],
    "icons" : {
        "48" : "icon-48.png",
        "128" : "icon-128.png"
    },
    "manifest_version": 2
}

0 个答案:

没有答案