I am developing an extension for Google Chrome, which need to call some REST Api outside. My problem is I can't invoke API with http protocol while I can with https. Here is my permission configuration:
"permissions": [
"tabs",
"storage",
"cookies",
"http://*/*",
"https://*/*"
]
And here is the jQuery code to invoke outside sites:
var host = "https://www.google.com.vn/";
var xhr = new XMLHttpRequest();
xhr.open("GET", host, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status === 200) {
alert(xhr.responseText)
} else {
alert("Error with status:" + xhr.status);
}
}
}
xhr.send();
Above code work correctly with https sites, eg: https://www.google.com.vn/
, https://www.linkedin.com/
, ... but not working with http site such as: http://stackoverflow.com/
I am Android/iOS developer and I am really new with Chrome Extensions as well as jQuery. Please help to point me my mistake. Thanks in advance.