Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is document.cookie ever undefined?

I'm just curious if document.cookie can ever return undefined.

I read quirksmode's article on cookies and I looked at "Is !document.cookie reliable?" but they don't explicitly answer this question.

Can document.cookie ever be undefined?

like image 942
christo8989 Avatar asked Jun 05 '15 18:06

christo8989


1 Answers

The document.cookie property is defined in DOM Level 2, and implemented in every major browser. It sets/gets a string, which may be an empty string (which is falsey, but not undefined).

like image 191
Sampson Avatar answered Sep 20 '22 15:09

Sampson