Browser data stores – session, local, and IndexedDB
Browsers provide other features to store data locally, which can be read not only by any other component but also by any script running on the same page. We will not talk about cookies, but the new methods provided as key-value stores: SessionStore
and LocalStore
. But these are not the only options, as browsers also provide a database called IndexedDB
that offers much more storage space and can be accessed also outside the scope of our application’s window in a different thread. We will see how in Chapter 8, Multithreading with Web Workers, in more detail, while here, we will focus first on understanding the basic concept and limitations of each one.
SessionStorage
is a read-only object created for each page origin. It stores only string data that can be accessed and retrieved using a simple interface. This data exists only through the duration of the browser tab and persists during refreshes. A clear example of this...