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
To check the current page's cookies using Chrome:
Option 1
- Open Developer Tools (usually F12)
- Click the "Application" tab (used to be "Resources")
- Expand the "Cookies" list item
- 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.
7 Comments
document.cookie no contain of some cookies, but I can see that in the chrome://settings/siteData ?!!!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?!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/CookiesIn your console, type document.cookie. It will return the active cookies for that page.
4 Comments
document.cookie no contain of some cookies, but I can see that in the chrome://settings/siteData !!!