Hi I am new to Java Script and have a scenario I want to store some data on javascript cookies.
the probelm is javascript cookies can store only 4 KB of data. Looking for an alternate i found out jStorage and local-storage but these are not supported in all browser. Is there a work around for same.
if ($.cookie('test_data') == null ){
test_data.push({
qid: qid,
answer: answer
});
$.cookie("test_data",JSON.stringify(test_data) , { expires: expires, path: '/' });
}
else{
test_data = JSON.parse($.cookie("test_data"));
test_data = $.grep(test_data, function(e){ return e.qid != qid; });
test_data.push({
qid: qid,
answer: answer
});
$.cookie("test_data", JSON.stringify(test_data), { expires: expires, path: '/' });
}
This is the sample code I am using.
Here problem is if my answer is to big than cookie storage fails.I have to store group of answer for same.
Any help is appreciated.
Some ref Link I saw: Related Link