Storage
Cookies
Servers can set cookies using the HTTP Set-Cookie
header. JavaScript cannot read that header. [MDN]
document.cookies
is used to read or write cookies from the client-side [MDN].
Some users may have completely disabled cookies. In some browsers, this may break other (unrelated) APIs. [blog.tomayac.com]
IndexedDB
IndexedDB is a way for you to persistently store data inside a user's browser. Because it lets you create web applications with rich query abilities regardless of network availability, these applications can work both online and offline. IndexedDB is useful for applications that store a large amount of data (for example, a catalog of DVDs in a lending library) and applications that don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and notepads).
[MDN,
MDN,
MDN,
caniuse]
Browsers may have different storage and retention limits [MDN, MDN, web.dev].