Introduction to Storing Data in HTML

Cookies vs Web Storage

CookiesLocal/Session Storage
Small amount of data stored (<=4kb)Larger amount of data can be stored
Stored in text files or SQLite databaseStored in SQLite Database
Associated with specific websiteAssociated with specific website.
Sent with all request to the server evertimeData Stays on user or client side

Local Storage vs Session Storage

Local StorageSession Storage
Data does not expireData stored for life of the tab/browser
Remove data by clearing the cache or with JavaScriptData stored for life of the tab/browser
Data not sent to server with requestData not sent to server with request

Browser Storage Limits

know this will help you answering what you want to store, what you need to store and what you can store.

Chrome

For Local and Session Storage

  • Desktop = 10mb
  • Mobile = 10mb

Firefox

For Local and Session Storage

  • Desktop = 10mb
  • Mobile = 10mb

Test Storage

https://demo.agektmr.com/

Type of Data that can be Stored in Local/Session Storage

  • String

If you want to store more change JSON, Integer to String to Store and then convert it back at the time of retrival. JSON can be strigified and then parsed back.

Next