I have a chrome extension and am currently using the webrequest api. My question is simple, is it possible to block and modify an AJAX request with the webrequest api? If not is there a work around to this?
PS. I am trying to inject pieces of HTML into a GMail email but the only solution I have found so far involves detecting all the various types of composes and then inject my HTML. This method is fine except its unstable, only about 70% of the time the insertion works.
If there is a better way, do let me know, thanks!
EDIT
Found a few alternate solutions if anyone needs it.
- Override the default
XMLHttpRequest.send
method to broadcast an event. You can modify the request before it gets sent out. - Override the default form submit method and intercept all form submits before they are submitted (modify the form data)