我想要一个扩展弹出窗口中的一些在线音乐网站的内容,它通过 ajax 请求对每次更改的内容进行更改,例如下一首歌曲等。
如何innerText在扩展弹出窗口中获取电流?
XMLHttpRequest该网站在每首歌曲开始后加载。如何在弹出窗口中获取该 URL/响应?
我尝试了这个 JavaScript 代码但无法得到它:
var xhr = new XMLHttpRequest();  
xhr.open('GET','https://example.com/',true);
xhr.onreadystatechange = function() {  
  if (xhr.readystate == 4 && xhr.status == 200) {  
    alert(xhr.responseText);  
  }  
  else
    alert(xhr.status);
}  
xhr.send();