We're trying to read cookies (set with rails), but we're having huuuuuge problems reading them with javascript in IE6. For some reason, document.cookies is always nil. The cookies ARE set (we see them) but reading them in IE6 & javascript doesn't work for some reason.
We set the cookies in rails like this in the controller: cookies[:auth_token] = { :value => somevalue, :expires => somedate }
Console readout for setting the cookies: Cookie set: auth_token=3df2e4d86b36f7c6410452fc48f68f65e0c86993; path=/; expires=Sat, 14 Jun 2008 20:23:24 GMT
The javascript function for reading the cookie: function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') { c = c.substring(1,c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); } } return null; }
Has anyone ever had this problem, or better: know how to fix it?