Question

I'm setting cookies using jquery-cookies and appending a comma on every entry so it looks like this:

"ee337,ee389,ee347,etc."

I'm doing this like this:

if($.cookie('oswfav') == null){
    $.cookie('oswfav', id, {expires: 365});
} else {
    var curCook = $.cookie('oswfav');
    $.cookie('oswfav', curCook+','+id, {expires: 365});
}

In Firefox/Chrome, this works fine and they get appended correctly. However in IE, it works the first time (the first ID comes in fine) but adding more to the cookie doesn't work. I've tried setting them with PHP cookies too and got the same result.

Is there something I'm missing/need to set for IE to work?

Was it helpful?

Solution

I am not 100% sure if it will solve your pbm but give a try to this, use ; as separator.

I am also re-writing your code in a little different way

if($.cookie('oswfav')){
    var newCook = $.cookie('oswfav') + ';' + id;
    $.cookie('oswfav', newCook, {expires: 365});
} else {
    $.cookie('oswfav', id, {expires: 365});
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top