使用此代码片段时,它应该在加载 file://..
时记录 header url 也是如此,但它只适用于 http(s) 请求。
chrome.webRequest.onHeadersReceived.addListener((info) => {
console.log(info);
}, {
urls: ['<all_urls>']
}, ['responseHeaders']);
在你问之前,我使用 <all_urls>
在manifest.json
权限,如果我通过基本 content_scripts
执行此操作,它就可以工作API。
我应该提交 chrome 问题还是我的代码有问题?
最佳答案
来自the docs :
Note that for some of the supported schemes the set of available events might be limited due to the nature of the corresponding protocol. For example, for the "file:" scheme, only
onBeforeRequest
,onResponseStarted
,onCompleted
, andonErrorOccurred
may be dispatched.
关于javascript - 本地文件未触发 webRequest.onHeadersReceived,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35566567/