+ 1
Why the keys and values are not being displayed in the localStorage?
I made a web application using js. But the webStorage is showing a little problem. I am using Chrome as the development browser. So, when I tried to store some strings there are no keys and values related to the app are being displayed. I tried to use in both file and localHost but none of them worked.
6 odpowiedzi
+ 2
oh sorry.
In that case could you tell me more about your problem.
are you using window.localStorage or window.sessionStorage?
what exactly are you trying to store?
Have you read the documentation on MDN?
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
+ 1
local storage needs to be JSON encoded.
so whatever it is you're storing, do:
localStorage.setItem('your_key', JSON.stringify(your_data))
+ 1
Well im glad you sorted it 😁
0
Aidan Haddon-Wright I already did it dude...
0
Aidan Haddon-Wright No I mean to say that I did the JSON stuff already but still the problem is showing up...
0
Aidan Haddon-Wright I am using window.localStorage and I have made a Task List application so I am trying to store tasks (strings).