Skip to content

Read a Cookie with JavaScript

Learn how to read a cookie with JavaScript. With JavaScript, cookies can be read like this:

Advertisements
var cookies = document.cookie;
Advertisements
console.log(document.cookie)

//_ga=GA1.2.637925651.1599450342; _gaexp=GAX1.2.U2DF0lIpTsOVepnCdIak9A.18588.0; __gads=ID=a6dda264b9bbe6ed:T=1599450349:S=ALNI_MbFeXABfm5lrsUEhbK5hkFNA4xNmg; G_ENABLED_IDPS=google; _gid=GA1.2.183980896.1601097981
See also  Set cookies to expire in 1 hour in JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.