i have some cookies on my page, and i need to save it and load by page refresh. Saving is working normally, but when i try to refresh. I get "HTTP Error 400. The size of the request headers is too long", i have 7-8 cookie files in cookies and their summary size is about ~ 18kb. i need to save an object in cookie its too big, and i split it to array. Then i write it into cookieStore (it works correct)
$scope.cookieDataSavePrepare = function(data) {
var answerArray = JSON.stringify(data).match(/(.|[\r\n]){1,2048}/g);
for (var i = 0; i < answerArray.length; i++) {
$cookieStore.put('dataPart' + i, answerArray[i]);
}
$cookieStore.put('dataPartsNumber', answerArray.length);
};
$scope.cookieDataLoadPrepare = function() {
var dataLoad = [];
for (var i = 0; i < $cookieStore.get('dataPartsNumber'); i++) {
var file = 'dataPart' + i;
dataLoad.push($cookieStore.get(file));
};
return dataLoad.join('');
};
$scope.checkData=function() {
$window.localStorage.setItem('checkData', $scope.cookieDataLoadPrepare());
}
$scope.saveTestsToCookieStore = function () {
$scope.cookieDataSavePrepare($scope.data);
$cookieStore.put('answeredQuestions',JSON.stringify($scope.answeredTests));
$cookieStore.put('questionStopped',$scope.currentQN);
}
How can i manage it?