jqueryjquery-cookie

jQuery Cookies not working as expected in IE


I have Used jQuery Cookies to set a cookie variable as below

for(ck=1;i<= $.cookie('ck'); ck++){
   $.cookie('Answer'+answer, answer);
   $.cookie('questions'+ck, $('#quid').text());
   $.cookie('Answer'+ck, $('#'+answer).val());
   $.cookie('status'+ck, statuss);
   $.cookie('correctans'+ck, base64_decode(correctans)); 

}

It works Perfectly in chrome and firefox. it also works correctly in IE if the values of $.cookie('ck') is less then 9. if this is greater then 9, cookies of answer9 will be set and answer1 will be unset in IE.What have to do to resolve this?


Solution

  • I suspect you have reached the maximum number of cookies in IE. See: http://browsercookielimits.iain.guru/. If you are using IE 7 or later - would suggest refactoring your cookies into HTML5 local storage: http://diveintohtml5.info/storage.html.

    Just looking at the code it looks like you have more than 50 cookies for your domain.