gpt4 book ai didi

javascript - Firebug 1.2 document.cookie 与 Web Developer 不一致

转载 作者:行者123 更新时间:2023-11-30 18:59:34 25 4
gpt4 key购买 nike

我这里有一个 URI,其中通过控制台进行的简单 document.cookie 查询会导致显示三个 cookie。我还使用如下简单的代码验证了这一点:

var cookies = document.cookie.split(';'); 
console.log(cookies.length);

变量 cookie 确实出现了数字 3。另一方面,Web Developer 表示总共使用了 8 个 cookie。

我有点困惑地相信这是不准确的。我相信最好的解决方案可能是在不受 Firebug 影响的情况下重复上面的代码。但是,我想知道是否有人会建议一个更聪明的替代方案来破译哪个工具给我提供了不准确的信息。

最佳答案

一个原因可能是其他 5 个 cookie 是 HTTPONLY:

http://msdn.microsoft.com/en-us/library/ms533046.aspx

If the HttpOnly attribute is included in the response header, the cookie is still sent when the user browses to a Web site in the valid domain. The cookie cannot be accessed through script in Internet Explorer 6 SP1, even by the Web site that set the cookie in the first place. This means that even if a cross-site scripting bug exists, and the user is tricked into clicking a link that exploits this bug, Windows Internet Explorer does not send the cookie to a third party. The information is safe.

Firefox 也尊重这个标志(从 v2.0.0.5 开始)。

关于javascript - Firebug 1.2 document.cookie 与 Web Developer 不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/116682/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com