HTML5 Guidelines for Web Developers

(coco) #1
8.2 Offline Web Applications 219

Figure 8.5 Firefox information on an element in the offline cache


For the browser to reload the cache manifest, its content first needs to be modi-
fied. It is not enough to resave the file with the same content or update the date
of the last modification with the UNIX command touch. When developing ap-
plications, this leads to developers adding a character in a commented out line
only to then delete it again for a repeated reload request—a situation justifiable
during developing, but the question remains how this could be automated in a
productive environment.


If you use version control, such as Subversion, for your web applications, you
may have just thought of keywords, such as ID or revision, which Subversion au-
tomatically replaces in case of a modification. But such a keyword is also only
changed in the cache manifest file if its content has changed—so that’s another
dead end. One possible aid would be a script that reads the version of the direc-
tory when distributing the new application version and writes it into the cache
manifest. The prerequisite would be that all contents in the directory belong to
the cache. A shell command for UNIX could look like this:


SVNV=$(svnversion -n) && \
sed -e "s/^## svn.*/## svn repo version $SVNV/" \
-i menu.appcache


It replaces an existing comment line with the Subversion version of the current
directory.

Free download pdf