Razib
Razib

Reputation: 11173

Adding multiple local storage for same site

enter image description here

var testObject = { 'one': 1, 'two': 2, 'three': 3 };  
localStorage.setItem('https://mytestdomain.com', JSON.stringify(testObject));

Can anyone help me here?

Upvotes: 0

Views: 1232

Answers (1)

Ankit Saxena
Ankit Saxena

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

Related Questions