Here is a great example of Indexed DB

I think this will solve the data problem.
Other good sources
https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API