How to Update UI Files that are in the Offline Application Cache

How to Update UI Files that are in the Offline Application Cache

As of version 2.0, CollectionSpace uses HTML5 offline web application caching (aka "application caching", the "app cache"). See the W3C's description of Offline Web applications for more information about application caching.

Configuring Which Files are Cached in the Offline Application Cache

Some of the files that are cached are defined in a manifest file, which for cspace is ui/defaults/cspace.appcache. Currently, these files are in the manifest:

js/index.js js/template.js js/record.js js/myCollectionSpace.js js/findedit.js js/createnew.js js/advancedsearch.js js/administration.js css/index.css css/template.css css/record.css css/myCollectionSpace.css css/findedit.css css/createnew.css css/advancedsearch.css css/administration.css

In addition, HTML files with a manifest attribute will go in the application cache. For example, index.html has the line:

<html manifest="../cspace.appcache">

HTML files in the top level of the defaults/html directory will go into the application cache, because they all have the manifest attribute. HTML files in the pages directory won't; they're fragments that are pulled down by the browser in a separate request from the "main" part of the page. Since they don't have a manifest attribute (let alone an html tag), the browser won't put them in the app cache.

This means that if you want to edit any of the js or css files listed in the manifest, or any of the html files in the top level of the html directory, you'll have to deal with application caching when you want to see your changes.

Triggering Reloading of the Offline Application Cache

To tell browsers to reload cached files after you've made a change (without the user having to clear the cache manually), you have to change the manifest file.

Be sure to make a change to the manifest file whenever you make a change to a cached file, to ensure that your updates are visible to users.

In the UI source code tree, this file is in ui/defaults/cspace.appcache. If you're using the mini-build, this means you have to copy ui/defaults/cspace.appcache into ui/our-tenant, and then edit it there.

Changing the manifest file will trigger the browser to reload all of the cached files. Since we don't actually want to change the list of files that are cached, simply adding/editing a comment with a date and/or version number is a good approach.

CACHE MANIFEST # Last changed: 2/10/2012

See Also

You can configure various CollectionSpace files to be cached in in two different, complementary ways:

  • In the browser's HTML5 application cache (as described in this document)

  • In the browser's standard cache

To configure which CollectionSpace files may be cached in the browser's static cache, and how long they are cached, see:

Configuring Caching in CollectionSpace

As well, as a CollectionSpace user, to clear your browser's currently cached content, see:

Clearing cached content from browsers