我正在开发一个 chrome 扩展,并且在 backgournd 脚本上的任何 url 处的 XMLHttpRequest (cross-origin) GET 正在生成以下错误:
Failed to load resource: the server responded with a status of 407 ()
: proxy authentication required
当我在内容脚本上创建 XMLHttpRequest(跨域)时,它运行良好,没有 407 错误。所以我假设它与后台脚本代理设置有关,我根本没有接触过。
显现
"permissions": [ "<all_urls>" ]
背景.js
var xhr = new XMLHttpRequest();
xhr.open("GET", 'http://no-aesthetic.tumblr.com/post/110309507078', false)
xhr.send() //or any random urls
var result = xhr.responseText
console.log(result)
我知道不推荐使用同步调用,但这仅用于测试目的。我也尝试过异步调用,但没有任何成功。