I have a working WebExtensions extension (yay, so easy) but I’d like to be able to make outcalls, for example within an onHeadersReceived listener. Is that possible? I looked through all of the WebExtensions APIs and didn’t see anything related to outcalls, ajax, get, etc.
I think it would be the webRequest
module.
- https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#webRequest
- https://developer.chrome.com/extensions/webRequest
EDIT: oh wait, so you are using webRequest and are in the onHeadersReceived. Hm ok let me think Ill brb
You want to make your own XHR request? I don’t think there is a specific WebExtensions API for this, but you can make standard ajax-style XHR requests from a background script. This could be in response to an event or message. You can also make them from content scripts, but with many more restrictions.
Thanks for the encouragement, I found an example of direct usage of xhr and will give it a try.