Navigator cookieEnabled 属性

定义和用法
cookieEnabled 属性可返回一个布尔值,如果浏览器启用了 cookie,该属性值为 true。如果禁用了 cookie,则值为 false。
语法
navigator.cookieEnabled
浏览器支持
所有主要浏览器都支持 cookieEnabled 属性
实例
确定浏览器是否启用cookies:
<script> document.write("是否启用 Cookie: " + navigator.cookieEnabled); </script>
更多实例
本例中包含了所有的 navigator 属性。
<div id="example"></div> <script> txt = "<p>浏览器代号: " + navigator.appCodeName + "</p>"; txt += "<p>浏览器名称: " + navigator.appName + "</p>"; txt += "<p>浏览器版本: " + navigator.appVersion + "</p>"; txt += "<p>启用Cookies: " + navigator.cookieEnabled + "</p>"; txt += "<p>硬件平台: " + navigator.platform + "</p>"; txt += "<p>用户代理: " + navigator.userAgent + "</p>"; txt += "<p>用户代理语言: " + navigator.systemLanguage + "</p>"; document.getElementById("example").innerHTML = txt; </script>
