用于读取 HTTP 响应的 Chrome 扩展程序 [英] Chrome extension to read HTTP response
问题描述
我有这个 Chrome 扩展程序,可以在发送请求之前修改请求的标头.我现在希望能够在同一个扩展中检查响应的标头.我搜索了整个 Chrome 扩展 API,但找不到任何感兴趣的内容.
I have this Chrome extension that modifies the header of requests before sending them. I now would like to be able, within the same extension, to check the header of the response. I searched throughout the Chrome Extension APIs but I couldn't find anything of interest.
这是我用来修改请求头的代码,也许你知道我是怎么做的对你有用.
This is the code I use for modifying the header of the request, maybe it's useful for you to know how I do it.
chrome.webRequest.onBeforeSendHeaders.addListener(
function(details) {/*do something*/},
{urls: ["<all_urls>"]},
["blocking", "requestHeaders"]);
有谁知道怎么做,或者可以给我指出一个有趣的来源?谢谢
Does anyone knows how to do that, or can point me to an interesting source? Thanks
推荐答案
查看实时标题示例.
http://code.google.com/chrome/extensions/examples/api/debugger/live-headers.zip
对于后代,您可以在他们存档的错误/补丁站点上找到一个 live-headers.zip 版本 https://chromiumcodereview.appspot.com/9289057
For posterity you can find a version of live-headers.zip on their archived bug/patch site https://chromiumcodereview.appspot.com/9289057
最新版本 (2021) 不再包含 zip,但这是目录 https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/debugger/live-headers/?pathrev=226223
With the latest revision (2021) no longer including the zip, but here's the dir https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/debugger/live-headers/?pathrev=226223
这篇关于用于读取 HTTP 响应的 Chrome 扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!