Javascript database on browser hard-drive

590 views Asked by At

Background:

We're writing an HTML5 offline first application for Chrome Browsers.

We are targeting specifically Chrome Browsers, and we don't want to make an extension to serve the functionality of the app.

Our HTML application also makes to a back-end API data manipulation; but we would also like to store application state locally on the browser because the application offline-first.

The Issue:

So now I'm aware of the standard storage options like LocalDB, IndededDB, and "Web SQL" that get shipped with Chrome. I'm reluctant to use that to store application state because anyone with chrome can then edit their local state, and mess with the application's behaviour.

So the question is: - Is it possible to use something like

TaffyDB (www.taffydb.com),
JavaScriptSQL (http://javascriptsql.sourceforge.net/ARCH/en/index.html),
Lovefield (https://github.com/google/lovefield)

to make a database stored on the browser's hard-drive in a way that's not so easily hackable by the user?

If there is, then what would be the recommended tool for this task?

(We don't need the tool to work cross browser; just in Chrome)

2

There are 2 answers

0
David Mawer On BEST ANSWER

OK, so it turns out that in today's world there's not real space for this kind of thinking.

All databases now have been updated to use IndexedDB or WebSQL. If you don't want to use that technology, then you have to roll your own solution.

We finally decided on a level of encryption in our IndexedDB data so that the casual user could not edit messages easily.

0
IndexedDB User On

IndexedDB API is powerful, but may seem too complicated for simple cases. If you'd prefer a simple API, try libraries such as localForage, dexie.js, ZangoDB, PouchDB, idb, idb-keyval, JsStore and lovefield that make IndexedDB more programmer-friendly.