如何解决xmlhttprequest.getAllResponseHeaders() IE 不同于 Chrome 和 firefox
我尝试在发送 URL 后获取响应标头,它适用于 chrome 和 firefox,但不适用于 Internet Explorer: chrome 和 firefox 的响应头:
auth Bearer eyJXdjhgfdjhdjgfdjfbjfdhf...
但使用相同的方法,在 IE 中我得到了这个结果:
Cache-Control: no-cache,no-store,max-age=0,must-revalidate
Pragma: no-cache
Expires: 0
Content-Type: text/html;charset=UTF-8
Content-Language: fr-FR
我的代码:
var xhr= new XMLHttpRequest();
var url="***"
xhr.open("GET",url,true);
xhr.withCredentials = true;
xhr.send();
xhr.onreadystatechange = function() {
console.log('status=',this.status);
if (this.status == 200) {
console.log('all header=',xhr.getAllResponseHeaders());
var json = xhr.getResponseHeader("auth");
sessionStorage.setItem('Auth',json)
}
};
}
你能帮我解决这个话题吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。