How to clear basic authentication details in chrome

后端 未结 21 1519
暗喜
暗喜 2020-11-27 09:15

I\'m working on a site that uses basic authentication. Using Chrome I\'ve logged in using the basic auth. I now want to remove the basic authentication details from the brow

21条回答
  •  自闭症患者
    2020-11-27 09:58

    function logout(url){
        var str = url.replace("http://", "http://" + new Date().getTime() + "@");
        var xmlhttp;
        if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
        else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4) location.reload();
        }
        xmlhttp.open("GET",str,true);
        xmlhttp.setRequestHeader("Authorization","Basic YXNkc2E6")
        xmlhttp.send();
        return false;
    }
    

提交回复
热议问题