Methods
(static) get(sKey) → {string|null}
获取cookie
Parameters:
Name | Type | Description |
---|---|---|
sKey |
string | 名称 |
Returns:
- Type
- string | null
(static) has(sKey) → {boolean}
判断是否存在该名称的cookie
Parameters:
Name | Type | Description |
---|---|---|
sKey |
string | 名称 |
Returns:
- Type
- boolean
(static) keys() → {Array.<string>}
获取全部cookie名称
Returns:
- Type
- Array.<string>
(static) remove(sKey, sPathopt, sDomainopt) → {boolean}
删除cookie
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sKey |
string | 名称 |
|
sPath |
string |
<optional> |
它指定与cookie关联在一起的网页。在默认的情况下cookie会与创建它的网页,该网页处于同一目录下的网页以及与这个网页所在目录下的子目录下的网页关联 |
sDomain |
string |
<optional> |
domain属性可以使多个web服务器共享cookie |
Returns:
- Type
- boolean
(static) set(sKey, sValue, vEndopt, sPathopt, sDomainopt, bSecureopt) → {boolean}
设置cookie
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sKey |
string | 名称 |
|
sValue |
string | 值 |
|
vEnd |
string | number | Date |
<optional> |
过期时间, 数字类型单位是秒 |
sPath |
string |
<optional> |
它指定与cookie关联在一起的网页。在默认的情况下cookie会与创建它的网页,该网页处于同一目录下的网页以及与这个网页所在目录下的子目录下的网页关联。 |
sDomain |
string |
<optional> |
omain属性可以使多个web服务器共享cookie。domain属性的默认值是创建cookie的网页所在服务器的主机名。不能将一个cookie的域设置成服务器所在的域之外的域 |
bSecure |
boolean |
<optional> |
它是一个布尔值,指定在网络上如何传输cookie,默认是不安全的,通过一个普通的http连接传输 |
Returns:
- Type
- boolean