HTML and CSS Reference
behavior takes care of the first scenario listed because the timestamp of the modified cache manifest file is
different than that of the previously downloaded cache manifest.
However, the second scenario is slightly tricky. In that case, you aren't changing the cache manifest
file: you're changing the constituent files, and you expect the browser to use the new versions of those files.
Unfortunately, the browser doesn't check the timestamp of each constituent file, and it keeps using the
cached versions of the files. To rectify the problem, you need to change the timestamp of the cache
manifest file residing on the server. There are different approaches to doing this:
• Whenever one or more constituent iles change, run a utility that changes the
timestamp of the cache manifest file (you can easily develop such a utility using
• Open the cache manifest ile and make a pseudo-change to it (say, add whitespace
and remove it; or cut the entire contents of the file, save the file, paste in the
contents, and save the file back to the disk) so it has a new timestamp.
• Maintain a version number in the cache manifest ile, and change it whenever the
constituent files change.
Of these options, the last is simplest to implement. The other options are more suitable if you're
planning to build an automated way to update the cache manifest file.
Suppose the Clock.aspx file listed in Clock.cachemanifest changes due to a code-level revision, and
you wish to use a version number as a way to change the cache manifest. You can do so as shown in Listing
Listing 8-10. Cache Manifest with a Version Number
# version 2.0
Notice the bold code. The cache manifest file treats content following a # character as a comment. You
specify a version number in the comment. Whenever you change any of the constituent files, you need to
change the version number and save the modified cache manifest file. This way, the timestamp of the
cache manifest is also changed, and the browser downloads the cache manifest and its constituent files
n Note There can be some differences in the way cache manifest files are checked for a new version. If for some
reason (HTTP caching, for example) the cache manifest file is cached on the client side, the browser won't check
whether the file has been modified. If so, the user needs to manually remove the offline application files as