0

I am writing a browser extension which injects code to replace the page at a certain url.

However, this site has a service worker, which intercepts all the fetch/xhr requests made by my replacement page.

Is there a way for an extension to forcibly disable service workers for a specific tab/url, or to bypass them when making requests?

(I know you can call .unreigster(), but it seems like the service worker can just ignore this, and another tab could register a service worker at any time anyway.)

12Me21
  • 741
  • 8
  • 18
  • Don't make those fetch/xhr in the page, but instead send a message to the background script so it does them and returns the result back. You can even override the native window.fetch and XMLHttpRequest.prototype.send in [page context](/a/9517879). – wOxxOm Oct 10 '21 at 18:24

0 Answers0