Using IndexedDB to Persist Scores
Web developers needing to store information on a local client have traditionally had a limited number of options, most of which have had significant drawbacks. One of the oldest and simplest methods is the humble browser cookie. These little text files stored on the client’s browser are sent to the server alongside every request made by the browser client. Because of that, and for similarly related reasons, cookies aren’t an efficient or practical solution to many if not most client-side storage needs, including our own. For an in-depth examination of the different pros and cons of available client-side storage, see https://web.dev/storage-for-the-web/.
The IndexedDb Object Store (IDB) is a client-side, browser-sandboxed database enjoying a broad spectrum of consistently implemented support across major browsers and platforms. While the amount of data a site is allowed to store is limited to the disk space that’s available to...