Using the Local Storage

Sarah Chima on June 05, 2019

This article discusses what the local storage is and JavaScript methods that we can use to manipulate it. I have always known about the local stor... [Read Full]
markdown guide
 

So if I got this right - localStorage is a like cookies except expire part (ls lasts until cleared) and you can store more data in it?

Thanks for the article, it is super useful!

p.s. I relay like design of your Note App!

 

No it's not - especially not in terms of security (because LocalStorage has no security model).

See also Please Stop Using Local Storage which shows some of the downsides.

 

It's also limited to the client for the specified site, servers and other sites can not access it

 

Thanks for reading. I guess your question has been answered by Marcel and Lars.

 

Sorry, but this article could be a bit misleading to newbie devs. It doesn't describe that accessing localStorage could result in a SecurityError (thus robust web apps should wrap LS access in a try-catch or similar mechanism), and the size of LS is not always equal to 5 MiB (on older Androids it is smaller, for example).

It would be fair to provide a link to MDN: developer.mozilla.org/en-US/docs/W..., which describes LS in greater details.

 

Session storage would be a better alternative also or no client side storage at all, even better, for legal and security reasons.

 

Short and simple, thats how all articles should be. Alas people think more jargons they use, more people see them as geeks.

 
 

If you just wanna be fine, dandy and secure wherever possible, use this github.com/localForage/localForage

API is pretty similar to localStorage but it uses IndexedDB or WebSQL where possible to allow quick and easy access.

 

Great article, simple and right to the point.
I had some cases in some projects at my company that I needed to extend how to work with the Local Storage, then I created these two packages here:

github.com/WendellAdriel/time-storage
github.com/WendellAdriel/counted-s...

Depending on which kind of app we're working with, Local Storage can be a good friend!!!

 

Hi Sarah! I loved your article and would like to include it in my June Newsletter that I send out. I'll put a link to this article and attribute you if you're alright with that?

 

Hi Jonathan. Thanks for reading my article. I'm glad you like it. It will be my pleasure for my article to be included in your newsletter.

 

Thank you so very much Sarah! I really appreciate that!

I look forward to your future work!

 
 
 
 
 
code of conduct - report abuse