문제

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?

도움이 되었습니까?

해결책

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});
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top