Local storage method: Indexed Database

After the release of HTML5, an important feature added to the front-end was local storage, which can be divided into four categories:

  • Local Storage: The total storage capacity is limited and does not provide a true retrieval API. The lifespan of data is longer than that of windows or browsers, and data can be shared by every window or tab from the same source. It has good compatibility and is the most commonly used storage method.
  • Session Storage: As long as the browser window is not closed, it will always exist. Truly valuable things should not be placed inside. Data will be saved to the window or tab where it is stored. When closed, data will only be visible in the window or tab where it was built
  • Index Database: In Index Database, objectstore replaces the traditional concept of tables. Each objectstore is equivalent to a collection of keys and values, and Index DB does not require additional installation like traditional SQL Server. Indexed exists on the browser side and can be accessed and controlled by users. It is the best solution to save insensitive user data and can also be used to create local applications.
  • Web SQL Database: It is not actually included in the HTML5 specification. Both indexed databases and indexed databases are solutions for storing large amounts of structured data on the client side. Web SQL database implements traditional SQL statement based database operations, while indexed database implements the storage method of nosql.
  • The indexed database is used to retrieve tree like object storage engines by directly executing synchronous or asynchronous function calls. The index database API avoids query strings and uses underlying APIs that support storing values directly in JavaScript objects. The values stored in the database can be obtained through keys or indexes, and the API can be accessed synchronously or asynchronously. The index database is also limited to the same source range.