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
Advertisement
Answer
See the live-headers example.
http://code.google.com/chrome/extensions/examples/api/debugger/live-headers.zip
EDIT: For posterity you can find a version of live-headers.zip on their archived bug/patch site https://chromiumcodereview.appspot.com/9289057
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