From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/navigator/cookieenabled/index.html | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 files/zh-cn/web/api/navigator/cookieenabled/index.html (limited to 'files/zh-cn/web/api/navigator/cookieenabled') 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 +--- +

{{ ApiRef("HTML DOM") }}

+ +

navigator.cookieEnabled 返回一个布尔值,来表示当前页面是否启用了 cookie。本属性为只读属性。

+ +

语法

+ +
let cookieEnabled = navigator.cookieEnabled;
+
+ + + +

示例

+ +
if (!navigator.cookieEnabled) {
+  // 浏览器不支持 cookie,或者用户禁用了 cookie。
+}
+
+ +

标准

+ + + + + + + + + + + + + + + + +
标准状态备注
{{SpecName("HTML WHATWG", "webappapis.html#dom-navigator-cookieenabled", "Navigator.cookieEnabled")}}{{Spec2("HTML WHATWG")}}初次定义
+ +

浏览器兼容性

+ + + +

{{Compat("api.Navigator.cookieEnabled")}}

-- cgit v1.2.3-54-g00ecf