How to check if the browser has cookies turned off?
Check the property “navigator.cookieEnabled”, which directly tells you whether the browser has cookies enabled.
If your browser has cookie enabled, you'll see “Yay, cookies!” below, else you'll see “O, no cookies!”.
Here's the code:
if (navigator.cookieEnabled) { document.write('<p><span style="color:blue">Yay, cookies!<\/span><\/p>'); } else { document.write('<p><span style="color:blue">O, no cookies!<\/span><\/p>'); }
You can always test whether the browser can accept a cookie by setting a cookie, and see if it is taken. You set a cookie by “document.cookie”.
https://developer.mozilla.org/en/DOM/document.cookie