0
votes

Can someone show a complete example of application cache with html, css, js, appcache file including CACHE, NETWORK and FALLBACK section. Also updating the manifest. Where should the coding be written?

http://www.html5rocks.com/en/tutorials/appcache/beginner/#toc-updating-cache As per updating cache from the above link, where should the coding been written?

1

1 Answers

0
votes

The code for updating the manifest is written by your sever somewhere.

Either in PHP or Node.js you must write and serve this file with the correct mime type as specified in the link you posted.

You can auto generate this from the css and js files on your server. Don't include html files unless they are dynamic pages.

The first line in the file must be CACHE MANIFEST

Now it assumes your are putting things into the CACHE section, which is where you need to include all the paths to your css and js that you want the user to be able to use offline.

To create a NETWORK section, simply print out the word on it's own line.

Under this section you should include pages that should only be used online.

Under the FALLBACK section include a page to show if there is no offline version available.

This is a brief explanation but you should be able to easily find a tutorial that will help you auto generate this file.

For more details about the cache manifest itself:

http://diveintohtml5.info/offline.html

Offers the best explanation IMHO.