As we've already seen, LocalStorage and IndexedDB are standard APIs available in modern web browsers. However, there are always small discrepancies between implementations (for example, around error handling), and it is usually simpler to rely on a library, both for homogeneity and simplicity.
In our case, we will use the localForage library, which provides an easy-to-use API on top of both IndexedDB and LocalStorage. By default, it will try to use IndexedDB and will fall back to LocalStorage if it isn't available. You can find the documentation for localForage here: https://github.com/localForage/localForage.