Chrome扩展程序读取HTTP响应 [英] Chrome extension to read HTTP response

查看:444
本文介绍了Chrome扩展程序读取HTTP响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个Chrome扩展程序在发送请求之前修改了请求的标题。我现在希望能够在相同的扩展名中检查响应的标题。我在整个Chrome扩展API中进行了搜索,但找不到任何有趣的东西。



这是我用来修改请求头的代码,可能对于你知道我是怎么做的。

  chrome.webRequest.onBeforeSendHeaders.addListener(
function(details){/ *做些什么* /},
{url:[< all_urls>]},
[blocking,requestHeaders]);

有谁知道怎么做,或者可以将我指向一个有趣的源代码?谢谢

解决方案

请参阅live-headers示例。 href =http://code.google.com/chrome/extensions/examples/api/debugger/live-headers.zip =nofollow> http://code.google.com/chrome/extensions/examples /api/debugger/live-headers.zip

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

解决方案

See the live-headers example.

http://code.google.com/chrome/extensions/examples/api/debugger/live-headers.zip

这篇关于Chrome扩展程序读取HTTP响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆