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");
It is limited to about 5MB and can contain only strings. LocalStorage is not accessible from web workers or service workers. Cookies have their uses, but should not be used for storage.
Local storage size capacity is approximately 10mb per domain in mobile and web browsers. The size differs in desktop browsers -- 10mb to 5mb depending on the browser version.
The key() method returns name of the key with the specified index. The key() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorrage object.
Note: Web storage APIs like LocalStorage and SessionStorage remain fixed at 5 MB. Note: Web storage APIs like LocalStorage and SessionStorage remain fixed at 5 MB.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With