Dissection of Web Storage

Md. Abu Talha
InfancyIT
Published in
3 min readOct 26, 2018

Today we will be discussed about the web storage. There are mainly five types of storage found in web storage system and these are Local Storage Session Storage IndexedDB Web SQL Cookies

Local Storage:

  • Stores data with no expiration date.
  • Data cleared only through JavaScript Actions or clearing the Browser cache / Locally Stored Data. Otherwise, the data will not be deleted when the browser is closed and will be available the next day, week, or year.
  • It’s essentially strings-only key-value storage.
  • It works on the same-origin policy. So, data stored will only be available on the same origin.
  • The data storage capacity is about 10MB.
via SitePoint

IndexedDB:

IndexedDB is similar to Local Storage and designed to achieve a similar goal, client-side storage, but they approach the task at hand from significantly different perspectives and work best with different amounts of data.

  • Designed to work with significantly larger amounts of data.
  • IndexedDB, as the name reveals, provides indexes.
  • Can run rudimentary queries on the database and fetch records by looking up their keys in specific key ranges.
  • IndexedDB also supports transactions.
  • Data storage capacity is similar to Local Storage

Session Storage:

  • It’s foundation similar to Local Storage
  • Stores data only for a session and the data is not persistent i.e. it will be lost once the window/tab is closed.
  • Data is never transferred to the server.
  • Data storage capacity approximately 5MB.

Cookie:

  • Can set the expiration time for each cookie.
  • Cookies are primarily for server-side reading.
  • Cookies can be made secure by setting the httpOnly flag as true and then it prevents client-side access to that cookie.
  • Data storage capacity less than 4KB.

Web SQL:

Web SQL was deprecated because standards are really important and turning Web SQL into a proper standard would have been prohibitively difficult.

  • Web SQL are basically wrappers around SQLite.
  • Fast and pretty feature-rich SQL implementation.
  • Available in Chrome and WebKit-based browsers (Safari, etc.) but not Firefox or IE.

Cache Memory:

Cache Memory is not in the list of web storage but it is important to have knowledge about it.

  • Cache memory, also called CPU memory.
  • Cache memory is a small-sized type of volatile computer memory.
  • Provides high-speed data access to a processor and stores frequently used computer programs.
  • It stores and retains data only until a computer is powered up.
  • The size (capacity) of Cache Memory is too limited because it is more expensive than RAM. Also, increasing the size may lead to latency and fail attempt to read/write problems.

--

--