Make your mobile webapp work offline with application cache

Posted on in Mobile

This tutorial will help you to put your mobile webapp offline.

1. create your cache manifest file
create a file yourappname.manifest in your application root.
In the file enter all files you have to cache to make your app working offline.

For example the app.manifest file looks like this:


# Explicitly cached entries




# Resources that require the user to be online.

#If source in inaccessible serve other file. for example: /index.php /index.html

2. Add your manifest to your application .html file header
In your html file:

3. Create a .htaccess file and add expire configuration for your *.manifest file to your app root.

ExpiresActive On
ExpiresDefault "access"

4. Add type manifest to your apache config (apache.conf / vhost.conf or .htaccess file)

AddType text/cache-manifest .manifest

That's it, now your app should work offline. You should know that, as soon as the manifest file fails with caching the files. It stops. That means that the files will not be updated.

Use this code to check/swap cache via code:

var i = -1;

// Convenience array of status values
var cacheStatusValues = [];
cacheStatusValues[0] = 'uncached';
cacheStatusValues[1] = 'idle';
cacheStatusValues[2] = 'checking';
cacheStatusValues[3] = 'downloading';
cacheStatusValues[4] = 'updateready';
cacheStatusValues[5] = 'obsolete';

// Listeners for all possible events
var cache = window.applicationCache;
cache.addEventListener('cached', logEvent, false);
cache.addEventListener('checking', logEvent, false);
cache.addEventListener('downloading', logEvent, false);
cache.addEventListener('error', logEvent, false);
cache.addEventListener('noupdate', logEvent, false);
cache.addEventListener('obsolete', logEvent, false);
cache.addEventListener('progress', logEvent, false);
cache.addEventListener('updateready', logEvent, false);

// Log every event to the console
function logEvent(e) {
var online, status, type, message;
online = (isOnline()) ? 'yes' : 'no';
status = cacheStatusValues[cache.status];
type = e.type;
message = 'online: ' + online;
message+= ', event: ' + type;
message+= ', status: ' + status;
if (type == 'error' && navigator.onLine) {
message+= ' There was an unknown error, check your Cache Manifest.';
log(i + ' ' + message);

function log(s) {

function isOnline() {
return navigator.onLine;

if (!$('html').attr('manifest')) {
log('No Cache Manifest listed on the tag.')

// Swap in newly download files when update is ready
cache.addEventListener('updateready', function(e){
// Don't perform "swap" if this is the first cache
if (cacheStatusValues[cache.status] != 'idle') {
log('Swapped/updated the Cache Manifest.');
, false);

// These two functions check for updates to the manifest file
function checkForUpdates(){
function autoCheckForUpdates(){
setInterval(function(){cache.update()}, 10000);

More info's, can be found here:

viagra canada cialis dosage recommendations cost of cialis cilias cialis price cvs pharmacy viagra coupons revatio vs viagra cialis 30 day trial coupon cialis coupons from manufacturer levitra vs viagra for hardness cialis medication non prescribed viagra viagra on line no prec cialis cheap viagra for women levitra generic viagra prices viagra single packs cost viagra vs cialis online cialis cialas viagra porn cialis patent expiration 2017 cialis daily natural viagra how to take cialis cialis sample levitra coupon cialis cost levitra loc us side effects of viagra generic for cialis how does viagra work viagra substitute price cialis viagra activate sildenafil vs viagra erectile dysfunction cialis levitra 10mg viamedic cialis cialis alternative viagra vs cialis vs levitra utilisation viagra what is levitra cheap cialis viagra coupons 75 off generic cialis at walmart cialis vs viagra cialis patent expiration date extended viagra dosage is viagra funded by government viagra girls cialis 5mg women viagra cialis 20mg cialis dosage cialis from canada pfizer viagra coupons discount viagra lowest cialis prices viagra pills for sale best price viagra viagra dose levitra cost how much does viagra cost viagra coupon cost of viagra what does viagra do buy viagra female viagra 9 levitra at walmart free viagra order online viagra 200 cialis coupon cheap viagra cialis pills buy viagra online free cialis is viagra federally funded cialis vs viagra cialis coupon cialis coupons is viagra covered by insurance levitra coupons what is cialis cialis without a doctor's prescription levitra prices viagra from amazon levitra viagra from canada generic viagra available in usa what is viagra viagra government funding cialis website how long does levitra last viagra side effects cialis voucher viagra savings offer buy cialis viagra patent expiration viagra generic cialis for women sophia viagra viagra coupons viagra vs cialis cialis pricing cialis coupon 20 mg how long does viagra last viagra sex where to buy viagra cialis otc cialis coupons printable levitra without a doctor prescription cialis canada levitra 20 mg herbal viagra levitra vs viagra cialis or viagra levitra side effects levitra canada does viagra work pfizer viagra wholesale cialis buy cialis online how does cialis work cialis coupon print viagra pills generic cialis tadalafil viagra cialis cialis for daily use viagra pharmacy does the government fund viagra cialis copay card viagra prices without insurance levitra dosage cialis professional cialis samples viagra 100mg price walmart natural viagra alternatives that work healthy man viagra cialis savings card trial viagra sample cialis or viagra how much does cialis cost cialis coupons 2017 side effects of cialis viagra on line viagra cost generic levitra levitra vs viagra cost of levitra cyalis cialis dosage strengths when will cialis go generic is viagra government funded buy levitra viagra alternatives cialis 5 mg cialis for sale buy levitra online cialis discount cialis testimonials viagra generic viagra viagra for sale viagra samples cialis 20mg directions liquid cialis cialis free trial cialis canadian pharmacy sex viagra for women over the counter viagra viagra 100mg tablets retail price discount cialis viagra best price viagra without a doctor prescription usa otc viagra viagra ingredients generic for viagra walgreens viagra substitute cialis prices levitra online canadian viagra canadian cialis levitra 20 mg cost walmart viagra vs cialis vs levitra female viagra pills daily cialis cialis cialis pharmacy prices cialis generic cialis generic availability levitra 20mg levitra 10 mg levitra reviews viagra single packs cialis 30 day sample cialis tadalafil viagra without prescription cialis for bph cialis samples overnight levitra vs cialis cialis 5mg daily cialis effects generic viagra 100mg online viagra cialis pills for sale viagra government funded cialis on line cialis trial generic cialis viagra pill cialis 20 mg viagra online inexpensive viagra pills cialis side effects viagra costs viagra price viagra coupons from pfizer cialis reviews cealis is viagra government funded in america stendra vs viagra viagra without a doctor prescription cialis 10 mg cialis patent expiration canada cialis cialis for men cialis online cialis generic tadalafil canada viagra

Post a Comment

Your email is never published nor shared.
Required fields are marked *