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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---