Linked Questions
347 questions linked to/from How to store objects in HTML5 localStorage/sessionStorage
854
votes
6
answers
938k
views
How do I store an array in localStorage? [duplicate]
If I didn't need localStorage, my code would look like this:
var names=new Array();
names[0]=prompt("New member name?");
This works. However, I need to store this variable in localStorage and it's ...
20
votes
1
answer
22k
views
How to store a (dictionary) object in JavaScript localStorage? [duplicate]
I have a very simple dictionary .
var meta = {'foo':'1','moo':'2'}
I want to store this in the local storage and retrieve it.
window.localStorage.setItem("meta", meta);
var meta1 = window....
16
votes
3
answers
42k
views
How to store array in localStorage Object in html5? [duplicate]
How to store mycars array in localStorage Object in html5?
var mycars = new Array();
mycars[0] = "Saab";
mycars[1] = "Volvo";
mycars[2] = "BMW";
localStorage.mycars=?;
8
votes
4
answers
27k
views
localstorage - save array [duplicate]
I have localstorage working to where I can save inputs and push them to a list. Now I would like to save the list in localstorage because when I reload the list resets because of var fav = new Array();...
11
votes
1
answer
24k
views
Storing array content in session storage [duplicate]
I have data being displayed in a table. I delete a row, I need to hide it until that deletion is also exposed to the backend (It is exposed only after a minute).
There is also auto-refresh that ...
3
votes
2
answers
12k
views
react js localstorage value object [duplicate]
I save what I get from my backend to a local storage:+
async onSubmit(e){
e.preventDefault();
const {login, password } = this.state;
const response = await api.post('/...
3
votes
2
answers
8k
views
checking for not null not working with localStorage [duplicate]
var test = null;
if(test !== null){
console.log('should not be logged in the console');//it worked
}
localStorage.setItem('foo',null);
console.log(localStorage.getItem('foo'));//logs null
if(...
11
votes
3
answers
482
views
Why isn't localStorage accepting my object? [duplicate]
I need to store an object like the one I the example below in localstorage. I need to be able to retrieve this object and edit it, then save it back into localStorage for next time.
var data = {...
0
votes
3
answers
4k
views
Update specific value of object in localStorage [duplicate]
I want to update the dataId field of an object in localStorage.
Object:
let responseJson = {
id: user.id,
username: user.username,
...
1
vote
3
answers
5k
views
Login function saving token to localStorage as [Object][Object] [duplicate]
I am trying to login to my user account which is saved on database and attach a token to that username with 'jwt-token'.
router.post('/users/login', (req, res) => {
User.authenticate()(req.body....
3
votes
2
answers
3k
views
How to save functions in localStorage API HTML5 [duplicate]
I am trying to save an array in localStorage but it contains functions (called promise) in an object of the array, but the problem appears when I convert array to string using JSON.stringify, ...
3
votes
0
answers
5k
views
How to store objects and arrays in HTML5 localStorage? [duplicate]
Ok, I have to use the localStorage to store an object, and an array. However, whenever i set something, it stores a string value instead. For example:
var x = [1,2,3];
localStorage["x"] = x;
console....
-1
votes
2
answers
4k
views
Storing data into Local Storage after first fetch [duplicate]
I am able to fetch data from an api. But my page keeps fetching the data from the api whenever the page loads. I tried to solve this issue using localStorage like below.
I try to load the data ...
3
votes
1
answer
1k
views
Retrieving JSON data in web storage not working [duplicate]
Possible Duplicate:
Storing Objects in HTML5 localStorage
I'm trying to store JSON data, name & phonenumber given in two text fields and then later(after page refresh) retrieve and print the ...
0
votes
1
answer
2k
views
Storing prompt response in localStorage and retrieving [duplicate]
i am creating a website that remembers your name and welcomes you back the second time you reload the page. I am storing the data in the localStorage because its better than cookies and its never ...