Different types of browser storage

Viewed 11299

From this slideshow http://slides.html5rocks.com/#slide8 and from Chrome: View > Developer > Developer Tools > Storage tab,

I learned that there are at least 4 types of browser storage: Databases, Local Storage, Session Storage, Cookies (are there more?)

What are the differences? When should I use one over the other?

For example, if a site wants to store user preferences, which storage method should the site tell the browser to use?

2 Answers

The thing you are asking is about the Web Storage which is basically an HTML Web Storage. Local Storage- Used as a volatile storage (has no expiry) Session Storage - Till a session is being used or a tab is open IndexedDb - Once used, you have to manually clear it (History or going in Storage) WebSQL - Old but still used the same SQL queries - It's not a part of HTML5 specification now. Cookies - Are the most common to save small about of data, They are used by all the website and these days they every website using it should ask for user permissions. That's GDPR BTW!

Image from Chrome Developer Tools

Related