I'm just wondering if document.cookie return undefined .
document.cookie
undefined
I read the quirksmode article on cookies and I looked at Is! is document.cookie reliable? "but they clearly donβt answer this question.
Can document.cookie be undefined ?
The document.cookie property is defined in DOM Level 2 and implemented in each main browser . It sets / gets a string, which can be an empty string (which is false, but not undefined ).
Not.
Here you can read the specification http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-8747038
It throws an error if it is given a value that does not meet the specification.