Over a million developers have joined DZone.

HTML5's IndexedDB: tutorial series

DZone's Guide to

HTML5's IndexedDB: tutorial series

· Web Dev Zone
Free Resource

Never build auth again! Okta makes it simple to implement authentication, authorization, MFA and more in minutes. Try the free developer API today! 

As a former database developer/admin, I'm often tempted to think of all computers as datastores that sometimes store particularly interesting data. After all, the most fundamental split in modern computer architecture occured over exactly where different kinds of data (including instructions) are stored.

Some of the confusion over HTML5's new database support has orbited around the data/instruction issue too. For some clarification on that front, look over Gerard Gallant's post from a few weeks ago. As Gerard observes:

To avoid any confusion, HTML 5 Web Storage is not the Index Database API or the Web SQL Database which are also HTML 5 related features that some browsers have started to support.

HTML 5 Web Storage is a form of browser storage that is similar to cookies but with several advantages.

Gerard goes on to list and discuss some of these advantages (worth browsing).

But in a way (as Gerard observes) Web Storage isn't fundamentally different from cookies. It's just a lot more powerful.

IndexedDB, on the other hand, is something different altogether. The specification is designed specifically for applications that address much larger stores than browsers using Web Storage will permit (usually just 5MB).

You can read the full spec (specs are always fascinating until they alter your state of consciousness), but for a quick overview you'd probably prefer a developer's perspective over W3's.

Providing that developer's perspective, Kristof Degrave just updated his multi-part tutorial series on creating and deleting a database, opening and a closing database connection, and defining a database structure in IndexedDB, with a nice little 'IndexedDB basics' intro thrown in for good measure.

Kristof's summary of the specification gets to the heart of IndexDB's power:

The Indexed DB specification provides an advanced key-value data management. It does this by using a transactional database to store their keys and corresponding values (more than one value for 1 key is allowed) and providing a means of traversing keys in a deterministic order.

Read the intro here, the creating/deleting/opening/closing tutorial here, and the defining tutorial here.

Launch your application faster with Okta’s user management API. Register today for the free forever developer edition!


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}