Reputation: 10010
I've been reading http://www.html5rocks.com/en/tutorials/offline/storage/
It sounds like the database is sandboxed. This is a problem for me, because the offline web app I've written - unfortunately one of the places it is being used is in has terrible mobile coverage and no wi-fi.
So what I'd like to do is write a native app which could grab the data from the IndexedDB database. Then maybe they can put it in an email, or plug it into a computer or something... it's very messy but I don't really have any other options.
Any ideas welcome.
Upvotes: 2
Views: 2277
Reputation: 20359
Instead of creating a native app, why not create an offline web app? That way you can continue using the IndexedDB database, but won't have to worry about connectivity.
The way to accomplish this is by using JavaScript Service Workers, which act as a proxy between the browser and the network. After you register a service worker, whenever the user requests a page from your site, the service worker springs into action.
So for instance, every time the user loads a page from your site, the service worker will check if there is internet connectivity, and if not, load the page entirely from the browser's cache instead of making a web request for the page. That way you can effectively create a website that works entirely offline after it's been loaded only once. Neat!
Upvotes: 1