Local Storage Basics

Local storage allows us to store JSON data about our app, site or plugin in the user’s browser and access it for faster loading, custom information and offline content.

Support for local storage comes native with the DOM and JavaScript using the following simple commands:

  • localStorage.setItem()
  • localStorage.getItem()
  • localStorage.removeItem()

It is important to remember to pass in valid JSON as well as parse the JSON back out into a native JavaScript object before you use in your app. Often folks save the parsed content as store in their apps.

Watch the Video

In this video we look at how to add, edit and delete local storage information. Follow along and see how simply you can integrate local storage into your app.

Taking Local Storage Further

In this JavaScript for WordPress Master Course we use local storage again and again when building JavaScript apps with and without WordPress.

To learn more about working with JSON and Local Storage save a seat in the next JavaScript for WordPress Master Course enrollment period.