Chrome扩展程序 - 与chrome.devtools.network相比读取响应主体的其他方式? [英] Chrome extensions - Other ways to read response bodies than chrome.devtools.network?

查看:913
本文介绍了Chrome扩展程序 - 与chrome.devtools.network相比读取响应主体的其他方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阅读(不修改)与Chrome扩展程序中某些模式匹配的所有请求的响应正文。我目前使用 chrome.devtools.network.onRequestFinished ,使用 getContent()方法为您提供 Request 对象。这工作得很好,但是当然需要devtools为扩展工作而开放。理想情况下,扩展名是一个弹出窗口,但 chrome.webRequest.onCompleted doesn似乎不能访问响应机构。 功能请求允许webRequest API 编辑响应的机构 - 但webRequest甚至可以读取它们?如果没有,还有其他方法可以读取devtools扩展之外的响应体吗? 解决方案

您链接的功能请求表示不支持阅读:


不幸的是,这个要求并不简单。 (...)关于阅读Response Body:从性能的角度来看,这是一个挑战。 (...)总的来说,这是不容易实现的...


所以,不,似乎没有作为扩展访问网络响应机构的一种方式,除devtools之外。

I'd like to read (not modify) the response body for all requests that match some pattern in a Chrome extension. I'm currently using chrome.devtools.network.onRequestFinished, which gives you a Request object with a getContent() method. This works just fine, but of course requires the devtools to be open for the extension to work. Ideally the extension would be a popup, but chrome.webRequest.onCompleted doesn't seem to give access to the response body. There is a feature request to allow the webRequest API to edit response bodies - but can webRequest even read them? If not, is there any other way to read response bodies outside of devtools extensions?

解决方案

The feature request you linked to implies that there is no support for reading either:

Unfortunately, this request is not trivial. (...) Regarding reading the Response Body: This is challenging from a performance perspective. (...) So overall, this is just not easy to achieve...

So, no, there doesn't seem to be a way for an extension to access network response bodies, except for devtools.

这篇关于Chrome扩展程序 - 与chrome.devtools.network相比读取响应主体的其他方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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