Forum Moderators: open

Message Too Old, No Replies

How to read the cookie value in javascript?

         

toplisek

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

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



I have cookie name like cookiemyname and its value.
How to pass such value into Javascript as variable in the correct way?

htmlbasictutor

8:08 am on Nov 20, 2017 (gmt 0)

10+ Year Member



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...]

toplisek

2:53 pm on Nov 21, 2017 (gmt 0)

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



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.