QUICK START AN OFFLINE APP
As with most HTML5 technologies, the basic usage is quite simple:
- Create a trivial trio of HTML, CSS, and JS files, maybe with an image or two. (Or reuse an existing toy app.)
- Link to a “cache manifest” file from your HTML file’s html taglike so:
PLAIN TEXT
HTML:-
<html manifest=”clock.manifest”>
-
- Make the manifest file. It’s just the literal phrase “CACHE MANIFEST” on the top line (I know, bit random), followed by the list of files in your app:
CACHE MANIFEST clock.html clock.css clock.js clock.png
- Mark it as MIME type text/cache-manifest. If you’re SSHing to a virtual host (like I did with Dreamhost), all you need here is a one-line .htaccess file:
AddType text/cache-manifest manifest
That’s it. Now those files above will be cached locally and won’t need to be downloaded again next time. To test it, load the site, shut down your net connection, and reload. It’s still there innit.