document.cookie是未定义的吗? [英] Is document.cookie ever undefined?
本文介绍了document.cookie是未定义的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是好奇,如果 document.cookie
可以返回 undefined
。
I'm just curious if document.cookie
can ever return undefined
.
我阅读了有关cookie的 quirksmode的文章,我看了一下 Is!document.cookie可靠吗?但他们没有明确回答这个问题。
I read quirksmode's article on cookies and I looked at "Is !document.cookie reliable?" but they don't explicitly answer this question.
可以 document.cookie
曾经未定义
?
推荐答案
document.cookie
属性是已定义,并在每个主要浏览器。它设置/获取一个字符串,它可能是一个空字符串(这是假的,但不是 undefined
)。
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
).
这篇关于document.cookie是未定义的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文