How to read a Cookie using JavaScript?

1 Answer(s)

Reading a cookie is just as simple as writing one, because the value of the document.cookie object is the cookie. So you can use this string whenever you want to access the cookie.

The document.cookie string will keep a list of name = value pairs separated by semicolons, where name is the name of a cookie and value is its string value.

You can use strings’ split() function to break the string into key and values.

Supporter Answered on August 15, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.