且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google Chrome扩展程序Http请求

更新时间:2023-12-05 20:27:16

Yes, using Cross-Origin XMLHttpRequest. Set the permissions in the manifest and use it like

var xhr = new XMLHttpRequest();
xhr.open("GET", "http://api.example.com/data.json", true);
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) {
    // WARNING! Might be injecting a malicious script!
    document.getElementById("resp").innerHTML = xhr.responseText;
    ...
  }
}
xhr.send();

相关阅读

推荐文章