代码
const http = new XMLHttpRequest();
var response;
const url = 'http://test/';
http.open('post', url, false);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.setRequestHeader("Cookies", 'Language=en');
http.onreadystatechange = function ()
{
if(http.readyState === 4)
{
if(http.status === 200 || http.status == 0)
{
alert(http.getResponseHeader('Set-Cookie'))
}
}
}
http.send('Username=test&Password=test=&Language=0');
它给了我null和Refused以获取不安全的标头。 有没有办法解决 ? 注意,我无法编辑服务器端代码。