F.e., maybe I can monkey patch fetch
and XMLHttpRequest
so that I can change the request. But what if some code is using window.location
? Can I monkey patch that somehow? What other ways?
答案 0 :(得分:0)
Yes. You can use Service Workers API. Check Service worker concepts and Using example. Using service workers you can intercept any requests and responses, reject them or pass. Beside that service workers are available throughout different pages, so pages can communicate.