你如何使用Chrome检查cookie?

时间:2022-05-28 21:23:39

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 Developer Tools中设置或类似?

8 个解决方案

#1


55  

To check the current page's cookies using Chrome:

要使用Chrome检查当前页面的Cookie,请执行以下操作:

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

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下的任何列表项,然后单击表左下方的取消图标)。

You can also check cookies with the javascript console, e.g. document.cookie, but the results are not formatted as nicely.

您还可以使用javascript控制台检查Cookie,例如document.cookie,但结果格式不正确。

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

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

#2


13  

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

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

#3


4  

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.).

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

#4


4  

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

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

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

#5


1  

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,还可以帮助您单独显示.delete(会话,域,路径)Cookie。

#6


1  

On chrome version 61:

chrome://settings/content/cookies

在Chrome版本61:chrome:// settings / content / cookies

#7


0  

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.

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

#8


0  

As of chrome v63 the location of cookies been has updated to:

从chrome v63开始,cookie的位置已更新为:

chrome://settings/siteData

铬://设置/ siteData

#1


55  

To check the current page's cookies using Chrome:

要使用Chrome检查当前页面的Cookie,请执行以下操作:

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

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下的任何列表项,然后单击表左下方的取消图标)。

You can also check cookies with the javascript console, e.g. document.cookie, but the results are not formatted as nicely.

您还可以使用javascript控制台检查Cookie,例如document.cookie,但结果格式不正确。

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

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

#2


13  

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

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

#3


4  

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.).

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

#4


4  

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

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

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

#5


1  

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,还可以帮助您单独显示.delete(会话,域,路径)Cookie。

#6


1  

On chrome version 61:

chrome://settings/content/cookies

在Chrome版本61:chrome:// settings / content / cookies

#7


0  

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.

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

#8


0  

As of chrome v63 the location of cookies been has updated to:

从chrome v63开始,cookie的位置已更新为:

chrome://settings/siteData

铬://设置/ siteData