Welcome to WebmasterWorld Guest from 54.226.25.74

Forum Moderators: open

Message Too Old, No Replies

How to read the cookie value in javascript?

     
3:02 pm on Nov 17, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1088
votes: 1


I have cookie name like cookiemyname and its value.
How to pass such value into Javascript as variable in the correct way?
8:08 am on Nov 20, 2017 (gmt 0)

Junior Member

5+ Year Member

joined:Mar 17, 2010
posts: 112
votes: 2


According to w3schools.com this should work:
var x = document.cookie; 

document.cookie will return all cookies in one string much like: cookie1=value; cookie2=value; cookie3=value;

Source: [w3schools.com...]
2:53 pm on Nov 21, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1088
votes: 1


Thank you. I have solved. Cookies values are not important if it is PHP or Javascript as source. Only function can solve and GET cookies value.