Well-deployed technologies
For simple data storage, the Web Storage specification offers two basic mechanisms, localStorage
and sessionStorage
, that can preserve data respectively indefinitely, or on a browser-session basis.
The Indexed Database API (IndexedDB) defines a database of values and hierarchical objects that integrates naturally with JavaScript, and can be queried and updated very efficiently - a third edition of the specification is under development.
Some of the data may need to be encrypted, the Web Cryptography API exposes strong cryptography primitives to Web applications, and can be bound to pre-provisioned keys via the WebCrypto Key Discovery API.
The HTML5 download
attribute provides a simple mechanism to trigger a file download (rather than a page navigation), with the possibility of setting a user-friendly filename.
Technologies in progress
The File API makes it possible to load the content of a file, for richer interactions with the file system. However, note discussions on a sandboxed filesystem API that could have allowed to write files onto a sandboxed file system have halted for lack of interest.
Exploratory work
As more and more data need to be stored by the browser (e.g. for offline usage), it becomes critical for developers to get reliable storage space. The proposed Storage specification will allow Web applications to get quota estimate for storage as well as to request that the data stored by the application be treated as persistent and cannot be evicted without the user’s explicit consent.
Discontinued features
- Quota management API
- Work on the Quota Management API, started in the Web Platform Working Group to expose an API to manage usage and availability of local storage resources, was discontinued in favor of the newer Storage proposal.
- Client-side SQL-based database
- The work around a client-side SQL-based database, which had been started in 2009, has been abandoned in favor of the work on IndexedDB.
- Address book data
- Communication applications can benefit from integrating with their users’ existing data records; on mobile devices, the address book is a particularly useful source of information. For Web apps outside of the browser, a purely programmatic approach was part of the System Applications Working Group; since this group has now closed, no further work on the Contacts Manager API is expected for the time being. Within the browser, HTML provides autocompleted fields for contacts information that would let browsers re-use data from address books.