Is document.cookie ever undefined?

I'm just wondering if document.cookie return 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 ?

+5
source share
2 answers

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

+3
source

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.

+1
source

All Articles