benchpresser
benchpresser

Reputation: 2188

Get cookie name and values using javascript

On a web page, I need all the cookies' name and value. The problem is that, for example, on Google Chrome, I can see cookie information using Developers Tools > Resources > Cookies, but it returns an empty string when I type "document.cookie" on the console.

Is there a 'javascript way' to display the coookie information as it is seen in the Resources tab?

Upvotes: 2

Views: 643

Answers (1)

Mario Nikolaus
Mario Nikolaus

Reputation: 2406

Those cookies are HTTP-only cookies and you cannot access them via Javascript. This would cause major security vulnerabilities.

For more clarification on security check OWASP documentation

https://www.owasp.org/index.php/HttpOnly

Upvotes: 1

Related Questions