According to the Firefox Content Script,the XMLHttpRequset can be used.
I have tried both XMLHttpRequest and Api Fectch.It only responses with error message. I already disable CORS on the server.It still dosen't work.
I run Django local server on the computer.
This is the code:
function getWord(word){
var req = new XMLHttpRequest();
req.open("GET", "http://127.0.0.1:8000/api/${word}/",true);
req.onload = function(){
console.log("done");
}
req.onerror = function(){
console.log("error : ",this.error);
}
req.send();
Console error:
error { target: XMLHttpRequest, isTrusted: true, lengthComputable: false, loaded: 0, total: 0, currentTarget: XMLHttpRequest, eventPhase: 2, bubbles: false, cancelable: false, defaultPrevented: false, … }
It work on other files(Not extension).
wordvariable is populated correctly? Check your browser's network tab. - CertainPerformancewordis the parameter of the function. - O.Chounry...instead of the useful message ...I already disable CORS- why? - Jaromanda Xreq.onerrorIt dosen't show anything. - O.ChounrywebRequestin your extension's permissions? developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/… - squgeim