I have set a cookie using
document.cookie =
\'MYBIGCOOKIE=\' + value +
\'; expires=\' + now.toGMTString() +
\'; path=/\';
No
Unfortunately, Javascript's cookie syntax is nowhere near as nice as that. In fact, in my opinion, it's one of the worst designed parts.
When you try to read document.cookie
, you get a string containing all the cookies set. You have to parse the string, separating by the semicolon ;
character. Rather than writing this yourself, there are plenty of versions available on the web. My favourite is the one at quirksmode.org. This gives you createCookie
, readCookie
and deleteCookie
functions.