+ 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.

10th Aug 2018, 7:57 AM
Vikas Sharma
Vikas Sharma - avatar
6 ответов
+ 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
12th Aug 2018, 4:27 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
+ 1
local storage needs to be JSON encoded. so whatever it is you're storing, do: localStorage.setItem('your_key', JSON.stringify(your_data))
12th Aug 2018, 2:32 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
+ 1
Well im glad you sorted it 😁
12th Aug 2018, 2:36 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
0
Aidan Haddon-Wright I already did it dude...
12th Aug 2018, 2:35 PM
Vikas Sharma
Vikas Sharma - avatar
0
Aidan Haddon-Wright No I mean to say that I did the JSON stuff already but still the problem is showing up...
12th Aug 2018, 2:38 PM
Vikas Sharma
Vikas Sharma - avatar
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).
13th Aug 2018, 6:10 PM
Vikas Sharma
Vikas Sharma - avatar