Thursday 20 October 2011

How to use cache-manifest for localstorage

So, you want your website to continue working on someone's laptop, when they're on a train and going through a tunnel.

Here is a technique for doing just that.

First create a .htaccess file for your site and add to it the following line:
AddType text/cache-manifest    .manifest

Next, create a file called cache.manifest. In this file, add the lines:
CACHE MANIFEST
index.html

Continue to add entries for any file you wish to be cached such as additional pages, images, scripts, stylesheets etc.

Now let's create the index.html file which will be cached:
<!DOCTYPE html>
<html manifest=”cache.manifest”>
<head>
<title>Cached Page</title>
</head>
<body>
My cached page.
</body>
</html>

There. Wasn't too difficult was it.

1 comment:

  1. I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious...
    Manifestation technique

    ReplyDelete