I’m new to cookies and rails so I apologize for my ignorance. I’m
using Javascript to store persistent cookies using the following code
(taken from the O’Reilly Javascript book):
Cookie.prototype.store = function( daysToLive, path, domain, secure )
{
var cookieval = “” ;
for ( var prop in this )
{
// Ignore properties wiht names that begin with the ‘$’ and also
methods
if ( ( prop.charAt(0) == ‘$’ ) || ( ( typeof this[prop]) ==
‘function’ ) )
continue ;
if ( cookieval != "" ) cookieval += '&' ;
cookieval += prop + ':' + encodeURIComponent( this[prop] ) ;
}
var cookie = this.$name + ‘=’ + cookieval ;
if ( daysToLive || daysToLive == 0 )
{
cookie += “; max-age=” + (daysToLive2460*60) ;
}
if ( path ) cookie += “; path=” + path ;
if ( domain ) cookie += “; domain=” + domain ;
if ( secure ) cookie += “; secure” ;
// Now store the cookie by setting the Document.cookie property
document.cookie = cookie ;
}
This works fine in Firefox but in IE7 it seems to work like a session
cookie. As soon as I close the browser it doesn’t exist.
I’m certain it’s something in Rails that I’m missing.
Thanks in advance for the help!