This is my JavaScript code I use to create my cookie…………
document.cookie = "Name=" + Name + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path/";
I create it in http://www.example.com/folder/file.html and it works.
But I cant read the cookie from http://www.example.com/index.html or http://www.example.com/folder2/file2.html.
What is wrong with my code?
you have an error in how you set the path
should be
Also, the format for the expiration date is wrong – it should be like
Thu, 2 Aug 2001 20:47:11 UTC, the same format that is returned bynew Date().toGMTString();.