Reputation: 11173
https://stackoverflow.com
, https://www.google.com
etc.https://mytestdomain.com
so I can see it in the yellow boxvar testObject = { 'one': 1, 'two': 2, 'three': 3 };
localStorage.setItem('https://mytestdomain.com', JSON.stringify(testObject));
localstorage
- https://stackoverflow.com
(#2, #3). It's not being added as a new localStorage
Can anyone help me here?
Upvotes: 0
Views: 1232
Reputation: 1207
That yellow box in the image represents all the sites which are storing some data in your localstorage. You cannot add a sitename (i.e https://mytestdomain.com
) using localstorage.setItem().
Using localstorage.setItem('key', 'val') only set value in current domain's local Storage
If you want some value under https://mytestdomain.com
domain, there should be a site with url - https://mytestdomain.com
storing something in your localstorage.
Check here in the official doc for more info - Documentation Link
Upvotes: 1