Opened 11 years ago

Closed 11 years ago

#7533 closed defect (invalid)

dojo.cookie.isSupported() always returns true in IE 6

Reported by: nobby Owned by: Ben Lowery
Priority: high Milestone: 1.2
Component: General Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Adam Peller)

Environment: IE 6, Windows XP

The function dojo.cookie.isSupported() always returns true, even when cookies are disabled.

The result is correct with Firefox 2 and 3 and with Safari 3.

Workaround:

   cookiesSupported: function() {
     dojo.cookie("test", "enabled", { path: "/" });
     var enabled = dojo.cookie("test");
     dojo.cookie("test", null, { expires: -1 });
     return enabled == "enabled";
   }

Change History (9)

comment:1 Changed 11 years ago by nobby

BTW, you can contact me at andreas@…. I also sent a mail to the user mailing list.

comment:2 Changed 11 years ago by Adam Peller

Description: modified (diff)
Owner: changed from anonymous to Ben Lowery

comment:3 Changed 11 years ago by nobby

navigator.cookieEnabled is true even if cookies are disabled.

comment:4 Changed 11 years ago by nobby

This seems to be a known issue:

http://codeidol.com/javascript/learning-javascript/The-Sandbox-and-Beyond-Cookies,-Connectivity,-and-Piracy/All-About-Cookies/

"Note that not all browsers return the correct value when testing the cookieEnabled property. For instance, IE 6.x does not set this property correctly."

comment:5 Changed 11 years ago by nobby

This seems to be a quite common issue with IE 6. There are a lot of threads on the web but unfortunately no solution apart from setting and reading a cookie :(

comment:6 Changed 11 years ago by James Burke

Milestone: tbdfuture

I favor not fixing this if it means writing a temporary cookie: it means we could clobber another valid cookie on the domain, if the cookie space for that domain is close to filling up.

I am tempted to say that we have lived with it for almost a year, and if we wait a bit longer, hopefully IE 6 will drop further to the point we can consider not supporting it.

Marking it for future though, for possible consideration in a release after 1.2.

comment:7 Changed 11 years ago by Adam Peller

hmm.. we already write a temporary cookie in some cases. I was going to just propose

-	if(!("cookieEnabled" in navigator)){
+	if(!("cookieEnabled" in navigator) || dojo.isIE < 7){

but hadn't had a chance to test this in IE6 yet. I don't think this would make things any worse than they already are.

comment:8 Changed 11 years ago by James Burke

Milestone: future1.2

That's what I get for triaging without looking at the code. :)

OK, moving it back for further consideration.

comment:9 Changed 11 years ago by Adam Peller

Resolution: invalid
Status: newclosed

It seems that navigator.cookieEnabled is true when cookies are disabled when using file: URLs. When browsing websites, it works fine, so unless you can show some circumstances where this fails running on a website, I'm going to have to mark this invalid. For file: URLs, isSupported() is arguably returning the right value given what appears to be an IE bug. It's able to set a cookie, so what else could we test for?

fwiw, my patch idea was not valid either. Trying to set navigator.cookieEnabled in IE6 results in an exception, so a little more branching would be required.

Note: See TracTickets for help on using tickets.