I am creating an app using HTML5 and Javascript. This app will be compatible with Windows and iOS 6 (iPad). I need a local database access using javascript. This is a pure offline ap with no server side involved.
My dilemma is -
WebSQL is not supported anymore by W3C.
IndexedDB works with Firefox but not with iOS6.
Most importantly, I want to avoid HTML5 Local database storage as it cleans data whenever history is cleared.
I would like to have a durable database locally for the app, something like SQLite. Is it possible to access SQLite using pure javascript, so that it will work with Firefox on Windows and also on iPad.
EDIT: The app will not be run from the browser in iPad (iOS6). Rather the app will be packaged into ipa file and installed in the iPad device.
What you're looking for is a polyfill.
According to HTML5 Please, IndexedDB Polyfill implements the IndexedDB APIs over WebSQL. (The author of the polyfill also wrote an article on Mozilla Hacks about it.)
Facebook also as a polyfill. According to this pull request (to another project), Parashuram Narasimhan, the author of the first polyfill, seems to prefer the Facebook polyfill and is considering retiring his own project. (But then again, the Facebook repo looks like a one-time code dump and may not have any ongoing development.)
There are some points to note.
The options left are using webSQL, IndexedDB, Third-party framework or custom solutions.
webSQL :- Support is limited to webkit browsers and w3c declared its dead. Browser support
IndexedDB :- Supports in IE10, chrome and Firefox. Browser support. Not supported in older versions of IE.
Third-party framework :- sequelsphere is a platform independent solution to address this issue. It is a RDMS written entirly in javascript and make use of webSQL or IndexedDB.
custom solutions :- Supporting both IndexedDB and WebSQL on a cross platform web app like this tutorial, we can create our custom cross-browser db solutions or may use lawnchair like json storage options.
We had same issue and got answered on this thread.
Lawnchair is a good choice if you need a single table DB - we had requirement of multiple tables, so have developed own wrapper.
Create a web app using HTML-5 and JavaScript, so that it can work for both desktop browser and iPad. Make it hybrid using PhoneGap for making it iPad's native app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With