I am developing a chrome extension to capture the network tab related data in chrome dev tools. my code as follows
manifest.js
{
"name": "Entries",
"version": "1.0",
"description": "Give me entries",
"devtools_page": "devtools.html",
"manifest_version": 2
}
devtools.js
chrome.devtools.network.getHAR(function(result) {
var entries = result.entries;
Console.warn("entries : " + entries.length);
});
getting the following error in console tab
Uncaught TypeError: Cannot read property 'network' of undefined
答案 0 :(得分:-1)
Chrome不允许用户从devtools读取网络日志,这意味着在devtools中运行脚本之前,您无法访问网络信息。要实现此目的,您需要创建一个新选项卡。 devtools帮助面板并在面板中运行脚本。