Search code examples
javascripthtmllocal-storageweb-sql

Client Side Storage with Web SQL Database


My application uses client side database storage using webSQL to store information for the user. I have heard that browsers are starting to turn away from webSQL. Currently only chrome, safari and Opera support it. Because IE and Firefox don't support webSQL I am using cookies to store information if the user is using those browsers. However cookies are not very secure and it is difficult to store large amounts of data. My question is then, is there any better option right now similar to the javascript API that all browsers support? Thanks.


Solution

  • I think IndexedDB would be an option for you which is an Object based data store. It is currently supported by Chrome, Firefox and IE 10 will also support it in future.

    Have a look at the following presentation to get a better understanding http://html5-demos.appspot.com/static/html5storage/index.html#slide1

    From my experience I would suggest to use a wrapper library just to reduce the risk in future changes in browsers. Few popular libraries are given below

    1. Storage polyfill By Remy Sharp
    2. Amplify.js By appendTo HTML5 API with fallbacks for HTML4 browsers (including IE6)
    3. RealStorage HTML5 API is a subset of overall API
    4. YUI3 CacheOffline by YUI team
    5. Persistence.js Asynchronous Javascript object-database mapper
    6. YDN-DB Easy to use database wrapper for IndexedDB, WebSql and localStorage build on top of closure library.