Kevin Simper
Kevin Simper

Reputation: 1687

Phonegap and Offline Cache

I have been trying out Phonegap and i really love who simple it is to make Phone Apps, if you already know webprogramming.

I am making a app for a website, to make it easy to follow when new posts are online.

I grab the feed and save it to localstorage, localstorage

but how should i cache images?

What are the best way to make your app offline friendly?

Is this the way to do it? HTML5 caching manifesto

Regards, Kevin

Upvotes: 1

Views: 6010

Answers (1)

chrisben
chrisben

Reputation: 955

I don't recommend using html5 cache manifest for a web app, unless you have a known list of images to cache that will hardly change, but in that case I would advise you to add the files locally into your phonegap application source.

In order to cache images in phonegap applications I created this library: imgcache.js. It stores images into the filesystem (db should be slower and has smaller disk space available I suppose). If you check out the examples you will see it can also detect when an image fails to load (when you're offline or the server response times out) and replaces it automatically with the cached version.

Upvotes: 5

Related Questions