Javascript 您如何使用 Chrome 检查 cookie?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10014996/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 23:30:04  来源:igfitidea点击:

How do you check cookies using Chrome?

javascriptdebugginggoogle-chromecookiesdeveloper-tools

提问by Howdy_McGee

I'm testing some cookies that I'm creating via JavaScript. Is there a way to check if the cookie was set in Chrome Developer Tools or something similar?

我正在测试我通过 JavaScript 创建的一些 cookie。有没有办法检查 cookie 是否是在 Chrome 开发者工具或类似的东西中设置的?

回答by AlexMA

To check the current page's cookies using Chrome:

要使用 Chrome 检查当前页面的 cookie:

Option 1

选项1

  1. Open Developer Tools (usually F12)
  2. Click the "Application" tab (used to be "Resources")
  3. Expand the "Cookies" list item
  4. Click any list item.
  1. 打开开发者工具(通常是 F12)
  2. 单击“应用程序”选项卡(以前是“资源”)
  3. 展开“Cookies”列表项
  4. 单击任何列表项。

You can view cookies in detail here, and clear them out (click any list item under cookies then click the cancel icon on the bottom left of the table).

您可以在此处详细查看 cookie,并将其清除(单击 cookie 下的任何列表项,然后单击表格左下方的取消图标)。

Option 2

选项 2

Use the javascript console, e.g. document.cookie. The results are not formatted as nicely.

使用 javascript 控制台,例如document.cookie. 结果的格式不是很好。

Option 3

选项 3

There is also chrome://settings/siteData(was previously settings/cookies), which you simply visit as a normal web page, but that's probably less tailored towards developers.

还有chrome://settings/siteData(以前的设置/cookies),您只需将其作为普通网页访问,但这可能不太适合开发人员。

回答by Nick Beranek

In your console, type document.cookie. It will return the active cookies for that page.

在您的控制台中,键入document.cookie. 它将返回该页面的活动 cookie。

回答by quicklikerabbit

Latest version of Chrome (v52) has moved this functionality to the "Application" tab. So updated steps are:

最新版本的 Chrome (v52) 已将此功能移至“应用程序”选项卡。所以更新的步骤是:

  1. Open Developer Tools
  2. Click the "Application" tab
  3. Cookies are listed under the "Storage" list item on the left sidebar
  1. 打开开发者工具
  2. 单击“应用程序”选项卡
  3. Cookie 列在左侧边栏的“存储”列表项下

回答by ROMANIA_engineer

Another method is to type the following:

另一种方法是键入以下内容:

chrome://settings/cookies

in the address bar.

在地址栏中。

Then use the left click to see more details (content, expiration date, etc.).

然后使用左键单击查看更多详细信息(内容、到期日期等)。

回答by Joseph Cho

On the latest version of chrome Chrome v76the url is:

在最新版本的 chrome 上Chrome v76,网址是:

chrome://settings/siteData

铬://设置/站点数据

回答by Ari

On chrome version 61:

chrome://settings/content/cookies

在 chrome 版本 61 上:

chrome://settings/content/cookies

回答by kamal

You can also use web developer tool which not only helps you to view cookies but also helps you to display.delete (session,domain,path) cookies individually.

您还可以使用 Web 开发人员工具,它不仅可以帮助您查看 cookie,还可以帮助您单独显示.删除(会话、域、路径)cookie。

回答by eboye

If you want a tool (extension) that manages cookies and localstorage, sessions etc. the best I could find is HTML5 Storage Manager

如果你想要一个管理 cookie 和本地存储、会话等的工具(扩展),我能找到的最好的是HTML5 存储管理器

I'm using it all the time as it's always accessible and is very convenient.

我一直在使用它,因为它总是可以访问并且非常方便。