reading-notes

Reading 13 - Local Storage

Source: Smashing Magazine, Local Storage and How to Use It

Q1 Why would a developer use local storage for a web application?

Local storage is used because you don’t have to have each user register with the site to store information. HTTP is stateless, so when the page refreshes all the information is gone.

You can store caches of data locally, so you don’t have to reload large volumes of data every time a page refreshes.

Q2 What information should not be stored in local storage?

Any information you don’t want the user to be able to clear shouldn’t be kept in local storage.

Q3 Local storage can store what type of data? How would you convert it to that type before storing?

Local storage can only store strings. To be stored locally, the data first has to be converted to strings with JSON.stringify(), and then it can be returned to its original form with JSON.parse().

Things I want to know more about

How was local storage developed? How does locally-stored data look to developers? Can they see the information that users input locally, if it’s not accessible to the server?