Đối tượng navigator.cookieEnabled dùng để phát hiện cookie có bị tắt không.
if (navigator.cookieEnabled) {
document.write("Cookies Enabled");
} else {
document.write("Oops Cookies Not Enabled");
}
Lưu ý: navigator.cookieEnabled trả về true/false. Tuy nhiên, user có thể chặn cookie cho site cụ thể (site settings) mà vẫn bật chung → kết quả có thể không chính xác 100%.