Is there a limit to the key length for localStorage?

Is there any limit (up to the amount of local storage available) for the key when using localStorage?

i.e. can I do something like:

localStorage.setItem("pretend that this is a 1MB string", "whatever"); 

Solution 1:

Yes, the limit is 5MB per domain. Your string can be as long as you want. The total usage must, however, be under 5 MB.

http://dev.w3.org/html5/webstorage/

http://www.stackoverflow.com/questions/2747285/html5-localstorage-restrictions-and-limits