Navigator cookieEnabled 属性
页面下方有更多实例。
定义和用法
cookieEnabled 属性返回一个布尔值,该值指定浏览器中是否启用 Cookie。
有关 cookies 的更多信息,请阅读 JavaScript Cookies 教程。
浏览器支持
属性 | |||||
---|---|---|---|---|---|
cookieEnabled | Yes | Yes | Yes | Yes | Yes |
语法
navigator.cookieEnabled
技术细节
返回值: | 布尔值,指示浏览器中是否启用了Cookie。 如果启用,则返回true,否则返回false |
---|
更多实例
实例
在以下实例中演示了所有 navigator 导航器属性:
var txt = "";
txt += "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt += "<p>Browser Name: " + navigator.appName + "</p>";
txt += "<p>Browser Version: " + navigator.appVersion + "</p>";
txt += "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt += "<p>Browser Language: " + navigator.language + "</p>";
txt += "<p>Browser Online: " + navigator.onLine + "</p>";
txt += "<p>Platform: " + navigator.platform + "</p>";
txt += "<p>User-agent header: " + navigator.userAgent + "</p>";
亲自试一试 »
txt += "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt += "<p>Browser Name: " + navigator.appName + "</p>";
txt += "<p>Browser Version: " + navigator.appVersion + "</p>";
txt += "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt += "<p>Browser Language: " + navigator.language + "</p>";
txt += "<p>Browser Online: " + navigator.onLine + "</p>";
txt += "<p>Platform: " + navigator.platform + "</p>";
txt += "<p>User-agent header: " + navigator.userAgent + "</p>";
❮ Navigator 对象