ตัวนำทางหน้าต่าง.cookieEnabled
ตัวอย่าง
เปิดใช้งานคุกกี้ในเบราว์เซอร์ของคุณหรือไม่
let cookies = navigator.cookieEnabled;
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติcookieEnabled
จะส่งคืนtrue
หากเปิดใช้งานคุกกี้ในเบราว์เซอร์
ดูสิ่งนี้ด้วย:
บท ช่วยสอนคุกกี้ JavaScript
ไวยากรณ์
navigator.cookieEnabled
คืนมูลค่า
พิมพ์ | คำอธิบาย |
บูลีน | true หากเปิดใช้งานคุกกี้ในเบราว์เซอร์ มิfalse ฉะนั้น |
ตัวอย่างเพิ่มเติม
แสดงคุณสมบัติของเนวิเกเตอร์ทั้งหมด:
let text = "<p>Browser CodeName: " + navigator.appCodeName + "</p>" +
"<p>Browser Name: " + navigator.appName + "</p>" +
"<p>Browser Version: " + navigator.appVersion + "</p>" +
"<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>" +
"<p>Browser Language: " + navigator.language + "</p>" +
"<p>Browser Online: " + navigator.onLine + "</p>" +
"<p>Platform: " + navigator.platform + "</p>" +
"<p>User-agent header: " + navigator.userAgent + "</p>";
รองรับเบราว์เซอร์
navigator.cookieEnabled
รองรับในทุกเบราว์เซอร์:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |