我在一个使用基本身份验证的网站上工作。使用Chrome我已经登录使用基本的认证。现在我想从浏览器中删除基本的身份验证细节,并尝试不同的登录。

使用Chrome浏览器时,如何清除当前的基本身份验证细节?


当前回答

对于Chrome 66,我在下面找到了相关选项:

右上…菜单->更多工具->清除浏览数据 点击“高级”页签 勾选“密码”框(取消你不想清除的密码) 按“清除资料”

使用一个新的隐身窗口可能更容易,但当你忘记并想要清除保存的密码时,这个方法不需要重新启动Chrome(这也有效)

其他回答

如果你在url中包含用户名,chrome似乎总是会显示登录提示。

http://me@example.com

这不是一个真正的完整的解决方案,请看下面Mike的评论。

我使用Chrome 83版本,这就是我是如何做到的。在执行上述步骤之前,请确保要删除的站点的“身份验证详细信息”选项卡已关闭。 首先,进入“设置”>>隐私和安全。

然后点击网站设置选项

然后点击查看权限和跨站点存储的数据选项

搜索您想要删除的认证信息的站点。在本例中,我使用Stack Overflow。

现在点击网站,然后点击清除数据按钮。

现在重新启动浏览器,系统会要求您重新登录。如果要重新启动,可以在地址栏中输入chrome://restart。

这是一个快速的技巧。 例如,您已经通过user1:password1输入url https://example.com的基本身份验证。要清除它,只需打开新标签,然后:

转到https://any:any@example.com,您的密码将被删除。

Any: Any是任意字符串。

正如@SalCelli提到的,chrome://restart工作。但是,这会重新启动所有的选项卡。

另一种方法是采用CEGRD建议的隐身模式

但是,如果你不喜欢在Chrome 86 (Mac)上重新启动和隐身使用,我发现@opsb和Mike提供的答案只适用于以下额外步骤。

Enter the wrong username in the url without the resources eg: if the url is http://mywebsite.com/resources/, it will not work if I enter http://wrong@mywebsite.com/resources/, but will work if I enter only http://wrong@mywebsite.com/ it clears the Basic Auth credentials prompt for the credentials again However, entering the valid credentials will not work, as in the background, chrome still send the wrong user as part of the url, even though the url appears right in the address bar When prompted for credentials you would need to Cancel, and click the address bar and reload the page from pressing enter. Now enter the correct password

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;
}