Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A polyfill for IndexedDB using WebSql
JavaScript HTML Other
branch: master

Refactored error-handling logic to match the behavior of native Index…

…edDB implementations

- Made certain errors synchronous instead of async
- Made asynchronous errors call IDBTransaction.onerror rather than just throwing
- Added quotes around index names in SQL statements to allow for index names with special characters

IndexedDB Polyfill Build Status

A polyfill to enable IndexedDB using WebSql.

IndexedDB is not supported on all browsers. This IndexedDB polyfill exposes the IndexedDB API in unsupported browsers using WebSQL. This shim is basically an IndexedDB-WebSql adapter.

More details about the project at gh-pages

Using this polyfill, you can use a single offline storage API across browsers (Opera, Safari, Firefox, Chrome and IE10) and even mobile devices (Phonegap on iOS and Android).

Using the polyfill

To use the polyfill, simply download the concatenated, minified product from the dist directory and include it in your HTML document.

If IndexedDB is not natively supported (and WebSQL is), the polyfill kicks in and makes a window.indexedDB object available for you to use. If you want to force the use of this polyfill (on Chrome where both IndexedDB and WebSql are supported), simply use window.shimIndexedDB.__useShim().


To build IndexedDBShim.min.js

  1. Ensure that you have node and grunt.
  2. Run npm install grunt-jsmin-sourcemap grunt-contrib-concat grunt-contrib-uglify grunt-contrib-connect grunt-contrib-qunit grunt-saucelabs grunt-contrib-jshint grunt-contrib-watch.
  3. Run grunt (or grunt.cmd on windows) on your command line
  4. The output files will be generated in the dist directory.


To check if the IndexedDB polyfill works, open test/index.html (hosted from a local server) and check if all the tests complete.


The IndexedDB polyfill has sourcemaps enabled, so the polyfill can be debugged even if the minified file is included. To print out debug status, use window.shimIndexedDB.__debug(true)


Pull requests or Bug reports welcome !!

Something went wrong with that request. Please try again.