0

Trouble with Localstorage reading

I have a script that generates 400 localstorage strings: for(i=1;i<401;i++){ localStorage.setItem(i,'empty'); } This works. And I have a script that should read this data: for(i=1;i<401;i++){ console.log(localStorage.getItem(i)); ... } When I run it, it logs only 23 times instead of 400. What's the problem?

7th Apr 2018, 8:05 AM
manu xx
manu xx - avatar
4 Respostas
+ 2
You should optimize your code workflow because 400 records is too much for localStorage! You should try to insert these entries in Array and then put this array in localStorage as string.
7th Apr 2018, 9:28 AM
Damyan Petkov
Damyan Petkov - avatar
+ 1
Hi Manu This seems to work for me. What platform are you using?
7th Apr 2018, 9:12 AM
Mike Choy
Mike Choy - avatar
+ 1
Mike, what do you mean with platform? @all, i solved the problem. Damyan, i will fix this later. But now, it works fine for me.
7th Apr 2018, 9:31 AM
manu xx
manu xx - avatar
0
Some known issues with Safari, but would be good to know what you did to fix for others
7th Apr 2018, 10:14 AM
Mike Choy
Mike Choy - avatar