I am trying to build a chrome extension which uses a xhr request to get response from a external api. I have set the permission for the extension as mention in the chrome extension document still xhr request is getting cancelled in network.
manifest.json
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html",
"default_title": "Chrome extension title"
},
"permissions": [
"activeTab",
"storage",
"https://*/"
]
In popup.js
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://putsreq.com/4z01VNOBPeD144njWNdi", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && this.status == 200) {
var theValue = "asdfassf";
alert("This is doen");
// chrome.storage.sync.set({'value': theValue}, ()=> {
// // Notify that we saved.
// document.location.href = "timer.html";
// });
}
}
xhr.send();