谷歌浏览器控制台输入JS代码检测请求地址是否跨域访问

青柚 / 2024-11-20 / 原文

var token= "your token";
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://d-web.keenlon.cn/gateway/code');
xhr.setRequestHeader("x-access-token",token);
xhr.send(null);
xhr.onload = function(e) {
    var xhr = e.target;
    console.log(xhr.responseText);
}

转载:https://blog.csdn.net/weixin_44260806/article/details/130105172