打开chrome浏览器,打开一个网站后打开【开发者工具】,里面的【Console】可以直接输入js代码测试:
var Authorization= "zU6CUSVs88DjC7hkzpeZGpUpphs=";
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://www.baidu.com/');
xhr.setRequestHeader("Authorization",Authorization);
xhr.send(null);
xhr.onload = function(e) {
var xhr = e.target;
console.log(xhr.responseText);
}
网友评论