访问者浏览器中是否启用 cookie?

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>Navigator 对象</h1>
  6.  
  7. <p>如果启用了 cookie,则 cookieEnabled 属性返回 true:</p>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. document.getElementById("demo").innerHTML =
  13. "navigator.cookieEnabled 是:" + navigator.cookieEnabled;
  14. </script>
  15.  
  16. </body>
  17. </html>