JS in the Browser

Browser Storage

The two main methods for storage in the browser are local storage and cookies. Both are key-value pairs, and both have JavaScript APIs, but they have two different use cases. Cookies are meant to be read on the server-side, while local storage is meant to be read on the client-side. Cookies are typically smaller (and have a smaller limit) since they're often sent over to the server during each HTTP request. Local storage is bigger (upwards of 5MB per domain), and will more often be used to maintain a persistent state in the client side application, and usually won't transfer any data over to the server.

When you need to store more data on the browser, IndexedDB is what you will use. It's a NoSQL database that is organized around JSON objects in a way that is similar to MongoDB.

results matching ""

    No results matching ""