Indexed Database API Becomes a W3C Web Standard

Originally proposed by database giant Oracle in 2009, the Indexed Database API “defines APIs for a database of records holding simple values and hierarchical objects” in browsers. Records are represented as key-value pairs that are indexed using a B-tree data structure. Records can be located by client-side browser applications using their keys or, alternatively, through the index.

The Indexed Database API, or IndexedDB as it is also referred to, supports transactions, which can be used to store or modify multiple records while protecting against failures. If a failure occurs, all operations in the transaction will be aborted and rolled back.

If the IndexedDB API sounds like a “real” database, that’s by intent. As the W3C’s recommendation notes, “[Browsers] need to store large numbers of objects locally in order to satisfy off-line data requirements of Web applications. WEBSTORAGE is useful for storing pairs of keys and their corresponding values. However, it does not provide in-order retrieval of keys, efficient searching over values, or storage of duplicate values for a key.”

As web applications get more sophisticated and developers seek to push more functionality into clients, having an efficient, queryable data storage option that supports transactions is all but a must. Fortunately, good support for IndexedDB is already available in many major browsers. Mozilla Firefox has supported it since version 10, Google Chrome since version 23, Safari since version 15, and Android Browser since version 4.4. Partial support for IndexedDB is available in recent versions of Microsoft Internet Explorer and iOS.

Lots of action at the W3C

As a W3C Recommendation, IndexedDB is officially a web standard and the product of a process that involves all of the major browser makers. In recent times, that process has become a refreshing source of consensus amongst major companies that have had their fair share of differences in the past. IndexedDB is the perfect example of that. Perhaps given the importance of local storage-related functions on today’s web, Microsoft and Mozilla came together in 2010 to support IndexedDB’s development.

Continued collaboration will be crucial to pushing the web forward as the W3C is working on many potential standards. Like IndexedDB, HTML5 recently achieved W3C Recommendation status and officially became a standard. A number of APIs, such as the Battery Status API and the Vibration API, are Proposed or Candidate Recommendations, which means they are closing in on Recommendation status. And there are numerous APIs, like the Geolocation API Specification and the Push API, that are in earlier stages as Drafts.

As these work their way through the process, the coming years should see a growing number of new API standards emerge with broad support and adoption.

Be sure to read the next Standards article: New JSON API Specification Aims to Speed API Development