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

问题描述

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

表示不支持阅读:

所以,不,似乎没有作为扩展访问网络响应机构的一种方式,除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:

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相比读取响应主体的其他方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 18:04