When I call this small piece of code in the Firefox browser console it works just fine. Sending a get request as it is supposed to.
{
var http = new XMLHttpRequest();
http.open("GET", "http://localhost:3456/?" + "q=test", true);
http.send(null);
}
But as soon as I put the code into my Firefox content script - "permissions": ["*://localhost:3456/*","webRequest"] are set in the manifest.json, it refuses to send that request.
sendLocalPostRequest("q=test");
function sendLocalPostRequest(params) {
var http = new XMLHttpRequest();
const aURL = "http://localhost:3456/?" + params;
http.open("GET", aURL, true);
http.send(null);
}
I have the feeling that something is blocking the web request, but I can't figure out what it is. I already checked if one of the code lines throws an error message, but there aren't any... Any ideas on what could be the problem here?
UPDATE: I just added a few new permissions and one or the other seems to have solved my problem. Here they are "tabs","*://*/*",