拒绝在XMLHttpRequest中获取不安全的标头“ Set-Cookie”

时间:2019-07-05 17:37:43

标签: google-chrome xmlhttprequest http-headers session-cookies setcookie

代码

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以获取不安全的标头。 有没有办法解决 ? 注意,我无法编辑服务器端代码。

0 个答案:

没有答案