[Javascript] Detect cookies?

Ben Curtis Quixote at LaMancha.org
Thu Aug 16 16:38:30 CDT 2001


> document.cookie = "cookies=true";
> var is_cookie = (document.cookie) ? "true" : "false";
> 
> --Josiah Gordon

Absolutely the way to do it, Josiah, although the value of is_cookie is
something I'd tweak:

var is_cookie = (document.cookie) ? true : false;

...to set it to Boolean values instead of strings.


Here's something else you can use: navigator.cookieEnabled is a Boolean
value that works in IE.

--
+Ben Curtis
...leveraging synergy right out of the box.









More information about the Javascript mailing list