Opened 13 years ago

Closed 10 years ago

#8038 closed defect (invalid)

Cannot set cookie for various conditions under IE6 or IE7

Reported by: ptwobrussell Owned by: ptwobrussell
Priority: high Milestone: future
Component: Core Version: 1.2.0
Keywords: Cc:
Blocked By: Blocking:


For a server-backed website, if you try to set a cookie like

dojo.cookie("a", "b", {path : "/blah"}) using IE6 or IE7 (haven't tested in IE8), the cookie simply will not set at all. FF and Safari seem to work fine as usual. I've tried various combinations of other cookie properties like "domain" and "secure" and nothing seems to ever work.

Oddly, or not so oddly enough, you can set a cookie using "expires" just fine and you can set a cookie if the path is "/" just fine.

For another weird twist, if you set a cookie using Dojo or just changing document.cookie such that you supply a path AND an expiration date like "foo=bar; path=/blarg; expires=3" then the IE developer toolbar registers that the cookie exists when you check under the "Cache -> Cookies" menu, but you can't actually get this value back out via document.cookie or dojo.cookie("foo") regardless of if you are at the domain specified or not.

I have no way to explain this behavior and can't find any documentation on it either. The tests for cookie are pretty weak, so if we figure these things out, we should add them to the tests.

I am totally at a loss here, so I would be happy if someone could either confirm this behavior or deny it so that I can destroy my VMWare images that have IE installed on them with a virtual sledge hammer.

And BTW, a simple way to whip out a console and try this for yourself is to grab Companion.JS and just go to a live site that hosts dojo like, do a dojo.require("dojo.cookie") and then have at it.

Change History (10)

comment:1 Changed 13 years ago by James Burke

I thought the rule was you cannot set cookies for paths that are more restrictive than your path? Does that explain it?

So, if you are on, and try to set a cookie with path /foo/, that will not work, but if the page is at, then it will work? Also, is it important to put a slash at the end of the path if you want everything in the /blah/path to get it?

All of this may just be FUD, just throwing some things out to try.

comment:2 Changed 13 years ago by Adam Peller

Owner: changed from anonymous to Ben Lowery

comment:3 Changed 13 years ago by frankq

behavior confirmed:

dojo.cookie(cookieName, dojo.toJson(data), {expires: 2, path: '/'});

does not work for IE6, but works for IE7, FF, Chrome.

comment:4 Changed 13 years ago by dante

Milestone: tbd1.4

comment:5 Changed 13 years ago by Ben Lowery

Status: newassigned

I'm going to need a better repro case to get to the bottom of this. I need:

  • The exact url you're hitting
  • The exact call you're making to dojo.cookie

comment:6 Changed 12 years ago by dante

Milestone: 1.41.5

comment:7 Changed 12 years ago by Adam Peller

Milestone: 1.51.6

comment:8 Changed 11 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:9 Changed 10 years ago by Ben Lowery

Owner: changed from Ben Lowery to ptwobrussell
Status: assignedpending

comment:10 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.