开发者

Access all stored cookies

开发者 https://www.devze.com 2023-02-14 01:34 出处:网络
I want to access my Chrome stored c开发者_开发问答ookies from the JavaScript console. Is this possible?If you only need the cookies for the active site: Have a look at document.cookie. It contains sem

I want to access my Chrome stored c开发者_开发问答ookies from the JavaScript console. Is this possible?


If you only need the cookies for the active site: Have a look at document.cookie. It contains semicolon-separated key=value pairs.

Edit: Note that due to security concerns you can't access cookies from a different domain. When you run something from the console, it's the equivalent of it running directly from the page, so since they don't want a spam site getting your Facebook credentials, you'll have to go to each website separately.


Easiest way to go:

console.log(document.cookie);


Using Chrome, if you have the possibility to use other tool instead of only the Console, you can access all stored cookies and see detailed information using the tab "Resources". To do this:

  • Open Developer Tools (F12)
  • Click on "Resources" tab
  • Expand the "Cookies" list item
  • Click on the website address
0

精彩评论

暂无评论...
验证码 换一张
取 消