Hey there! I have a chrome extension for a Reddit mod-team where I create a few buttons on the page that send out a POST request to the Reddit API, ultimately simplifying some of our work. I have always done so like $.post(‘URL’, { data }).done(function() { //do something });. POSTing this way has always worked on the chrome extension AND the previous versions of our firefox addon using the Add-on SDK. However I’m trying to port our exact chrome extension over, using the new WebExtensions and this just will not work with WebExtensions for whatever reason.
I had to change the way I handled storage (from chrome.storage.sync to browser.storage.local). After that, everything works perfectly when testing except well…it doesn’t send the request at all. I know there is a new requests module with WebExtensions and I have tried it as well but didn’t have much luck and to be honest would really just like to get this to work the way it always has. Nothing comes up in the firefox console at all, nor can i see any request go through from the network tab. The only way I’ve actually gotten this to work correctly with this new firefox WebExtension port was by manually sending the code through FF console… Any help would be very much appreciated!!
EDIT: SOLVED!
Turns out that when porting over to the new WebExtension, it really doesn’t like it if you use a relative URL in the request (at least in this case haha). I feel pretty dumb for not thinking about it, and probably should’ve been supplying a base domain string in each requests URL before adding an endpoint to begin with, but it didn’t really cross my mind since it had never been an issue with any previous Chrome version of the extension, or Firefox version using the older add-on SDK.