0

I would like to intercept any XHR or Fetch request with a chrome extension. But I also would like to return my own responses. The chrome.webRequest.onBeforeRequest.addListener seems very useful, but I get the impression you can only inspect the request. I was able to patch Fetch and XHR objects (using javascript injection), but this is not that easy and has its shortcomings. So my question is, can chrome.webRequest do this or not or should I use something else?

Jeanluca Scaljeri
  • 22,579
  • 44
  • 171
  • 286
  • In Chrome it's only [patching XHR or using chrome.debugger API](https://stackoverflow.com/questions/18534771/). Firefox has browser.webRequest.filterResponseData. – wOxxOm Dec 24 '21 at 21:23

0 Answers0