diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/navigator/cookieenabled | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/navigator/cookieenabled')
-rw-r--r-- | files/zh-cn/web/api/navigator/cookieenabled/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/navigator/cookieenabled/index.html b/files/zh-cn/web/api/navigator/cookieenabled/index.html new file mode 100644 index 0000000000..033531f4a4 --- /dev/null +++ b/files/zh-cn/web/api/navigator/cookieenabled/index.html @@ -0,0 +1,54 @@ +--- +title: Navigator.cookieEnabled +slug: Web/API/Navigator/cookieEnabled +tags: + - API + - DOM + - cookie + - 属性 +translation_of: Web/API/Navigator/cookieEnabled +--- +<p>{{ ApiRef("HTML DOM") }}</p> + +<p><code>navigator.cookieEnabled</code> 返回一个布尔值,来表示当前页面是否启用了 cookie。本属性为只读属性。</p> + +<h2 id="语法" name="语法">语法</h2> + +<pre class="brush: js">let cookieEnabled = navigator.cookieEnabled; +</pre> + +<ul> + <li><code>cookieEnabled</code> 是个<a href="/zh-CN/docs/Glossary/Boolean">布尔值</a>: <code>true</code> 或 <code>false</code>。</li> +</ul> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">if (!navigator.cookieEnabled) { + // 浏览器不支持 cookie,或者用户禁用了 cookie。 +} +</pre> + +<h2 id="标准">标准</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">标准</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("HTML WHATWG", "webappapis.html#dom-navigator-cookieenabled", "Navigator.cookieEnabled")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td>初次定义</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.Navigator.cookieEnabled")}}</p> |