简体   繁体   中英

Chrome extension intercept ajax requests to specific endpoints to modify form data

Is it possible to modify ajax requests to a specific endpoint on a webpage?

For example, all requests on wwww.example.com that go to /should_intercept will trigger a function that can modify the form data? If so, how can I intercept specific requests?

Yes, you can do it.

You can create a Proxy on XMLHttpRequest and inject it as a script into the page, to override original XMLHttpRequest. And inside your implementation of the Proxy, you will be able to handle requests as you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM