I recently played with cookies, and I noticed that when I create one with the value "Hello, World!" I get "Hello":
document.cookie = "testCookie=Hello, World!;";
Interestingly, if I do not add a space to "Hello, World!" , the cookie value will remain as I set it: ("Hello, World!")
document.cookie = "testCookie=Hello,World!;";
My only guess is why this happens because the comma and space β,β end cookies, such as semicolons and spaces, βdo.β Is this true, or am I doing something wrong?
source
share