Tuesday, May 18, 2010

HTML 5 Cache Manifest and dynamic data (Xpages)

So cache manifest files are a very useful tool. With dynamic data though they are a little tough to work with.

For example:

You want to cache some images and script libraries local, as well as css, and some other files. It does this great, but it will also cache the html generated by the xpage the first time it was opened.

The problem: the view information changes, and every time you open the xpage you get the initial html and wrong view information.

The first thing you need to do is set a partial refresh on the view info after load. But that is only half the battle, as maybe you have preferences for a theme, and the preference comes from a profile document. So the theme will not change.

The solution: Update the cache-manifest file which will make the page re-cache itself.

So how do you do this for every time a page is refreshed?

Well Notes makes it easy - you make a notes page. On the page properties tell it content type = text/cache-manifest. Name it something like my.manifest. Then on the version line of the manifest you enter in computed text set to @now. You will always have a new manifest that you can use to update your local cache with.


0 comments:

Post a Comment