Rik's Ramblings

Friday, May 30, 2014

Playing with AppCache for offline page access

I wanted a page to be accessible on my cell phone, even in cases where I had no network coverage. Obviously, appcache is a good solution.

Some links to useful resources:

htaccess additions

Here are my .htaccess file additions for the directory which is utilizing appcache (http://sagar.org/qrc/):

AddType text/cache-manifest .appcache

ExpiresActive On
ExpiresByType text/cache-manifest "access plus 0 seconds"

Adding an appcache manifest

The manifest file tells the browser which resources from the site to cache locally. The manifest is referenced via an attribute in the landing page's <html ... > tag.

Remember: the appcache must be of content-type text/appcache.

NOTE: unless the manifest changes, none of the referenced files will ever again be fetched from the server. That's the sole purpose of the comment line (see that "#" means comment) in the manifest. I can change it when I want to invalidate a browsers downloaded version of the website/webapp. Only when the manifest is modified will it's contents be re-examined and (if necessary) re-downloaded.

# 2014-05-30 v0.1


/qrc/ /qrc/index.html


Post a Comment

<< Home