0

As per my new requirement I have to change the name of the local-storage collection name, which is by default set to its domain name. Is this possible? I have already searched it and didn't get anything. It is just to confirm that is this possible. Suppose I have a domain named : http://www.example.com then the local-storage will be created as http://www.example.com and its key value pair. I want to change this from "http://www.example.com" to "http://www.example.com_local".

Please confirm me if it is possible anyhow. I am building an Umbraco website using MVC 4.

Thanks in advance.

Pankaj Nema
  • 165
  • 2
  • 13
  • possible duplicate of [Change key value in localStorage?](http://stackoverflow.com/questions/20862054/change-key-value-in-localstorage) – Per Hornshøj-Schierbeck Mar 09 '15 at 13:12
  • @PerHornshøj-Schierbeck thanks, but my question was about changing the collection name, this answer refers to change the key name. The collection name is set to its domain name by default. I want to change its name. – Pankaj Nema Mar 10 '15 at 05:36

1 Answers1

0

If it's not the key you want to change, but the value, then remember that localStorage operates on strings and only persists the value when you call setItem.

Keeping a reference to the original value you are setting, and changing that will not change anything in the localStorage. When dealing with the localStorage HTML5 API, then you need to re-set the value when you change it. You also need to re-set the value (and remove the old) if you change the key.

If you are using some helper API/library, then anything(almost) could be wrapped in it, making it impossible for me to help unless i know what library that is.

Per Hornshøj-Schierbeck
  • 15,097
  • 21
  • 80
  • 101