IE9 Creating Two Cookies When I Only Want One
Posted: Thu Apr 07, 2011 6:54 pm
I'm using document.cookie to set a cookie value to remember a treeview state which has always worked fine. Until I installed IE 9. Now, I've learned that IE apparently creates two cookies each time, one for http://www.domain.com and another for domain.com. (although I'm not sure why this wasn't an issue with older versions of IE)
The problem is that I end up with two cookies with the same name but two different values. One for the www version of the domain and one for the non-www version of the domain.
I read someplace that defining the domain when I set my cookie should solve the problem. It doesn't.
My code is as follows:
Does anybody know how I can either ensure both values are the same, or control which cookie I grab?
The problem is that I end up with two cookies with the same name but two different values. One for the www version of the domain and one for the non-www version of the domain.
I read someplace that defining the domain when I set my cookie should solve the problem. It doesn't.
My code is as follows:
When I view the cookie data using the IE Developer toolbar it shows one cookied named "r-moneytree" for www.timesavr.net with a value of "e" and a second cookie named "r-moneytree" for timesavr.net with a value of "c".document.cookie = r-moneytree=e; expires=Wed, 1 Jan 2014 23:46:34 UTC; domain=www.timesavr.net; path=/
Does anybody know how I can either ensure both values are the same, or control which cookie I grab?