In Chrome extension MV3, I want to intercept network requests and modify the response body
My goal is to find a way to track a specific network call, delay it, and modify the response if necessary.
Let's take the example of a user trying to reach
https://facebook.commake a request to
google.com and replace only the html content returned from FB with Google HTML.
By manipulating the response only (without changing the url)
We also have to wait for Google to respond to our request, which may take some time.
I checked:
Injecting a script into the DOM to override XHR: This method proves ineffective as the script is injected after the initial request to the target URL has already been made. Moreover, I seek to modify the response at the network level rather than altering the response/responseText directly.
Declarative Net Request (DNR) or similar MV3 approaches: These options do not offer the capability to modify or delay requests, rendering them unsuitable for my requirements.
Do we have another options/ any workarounds within MV3 extensions? Any insights or suggestions would be appreciated.