This chapter covers
- Using Javascript as a replacement for centralized cloud storage
- Handling local file storage using the Javascript Web Storage and IndexedDB client-side storage APIs
In this chapter, you’ll continue working with the Javascript programming of the Code Radio Web3 application from Chapter 3 to add client-side storage to allow it to function fully offline. Modern web browsers support a number of mechanisms for applications to store and retrieve data from a user’s local machine. This chapter focuses on two of these mechanisms: using the Javascript Web Storage and IndexedDB APIs.
Storing data on the user’s local machine can be useful in a number of scenarios, including but not limited to the following:
- Storing user preferences and site customizations, such as UI themes.
- Storing and maintaining user activities such as a shopping cart status between application sessions.
- Storing general application data such as image, music, and video assets locally, so that they load faster in future uses.
- Storing general application data such as image, music, and video assets locally, so that they can be used without an internet connection.