82

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?

7 Answers 7

130

To check the current page's cookies using Chrome:

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

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

Option 2

Use the javascript console, e.g. document.cookie. Less sophisticated (graphically), but you can work with the data using javascript. Note that the results will be restricted based on how websites are allowed to access local data from other sites (see MDN Same-origin policy).

Option 3

There is also chrome://settings/siteData (was previously settings/cookies). Just put the url into Chrome's address field.

Sign up to request clarification or add additional context in comments.

7 Comments

In recent versions of Developer Tools the tab is called "Application"
Why the document.cookie no contain of some cookies, but I can see that in the chrome://settings/siteData ?!!!
@NabiK.A.Z. Likely chrome is showing you cookies from a different domain. See “same origin policy”
@AlexMA No, seem the problem caused of option HTTP Only cookie, but the site opened on the HTTPS. But does can not see cookies in console by js, of same domain on the HTTPS?!
@NabiK.A.Z. The HttpOnly tag on cookies is somewhat misleading, but it does not mean the cookie is only sent when the protocol is http (vs https). The meaning of an HttpOnly cookie is that it is sent by the browser but it is not visible to JS. This is not to be confused with the Secure tag on cookies, which means the browser will only send it to sites using https (but which has no effect on the cookie's visibility in JS). There's a good description on: developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
|
26

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

4 Comments

Over the last week I'm starting to realize how awesome the JS console is! Thanks!
In Linux the JS console is just the [CTRL]+[Shift]+i keys away... and a click on the "Console" tab.
@DaFi4 Yes, Also I have this problem. The document.cookie no contain of some cookies, but I can see that in the chrome://settings/siteData !!!
It will return the active cookies for that page. - This worked for me , Thanks.
7

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

  1. Open Developer Tools
  2. Click the "Application" tab
  3. Cookies are listed under the "Storage" list item on the left sidebar

Comments

6

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

Comments

3

On the latest version of chrome Chrome v85 the url is:

chrome://settings/siteData

Comments

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.

Comments

1

On chrome version 61:

chrome://settings/content/cookies

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.