logo

Prevent Caching of Flex Apps In Domino

Browsers are really good at caching .SWF files. This can be a good or a bad thing. It's a good things until it happens that your customer is looking at the old version and not the one you've just fixed and the confusion then ensues.

What you need to do is make sure that when you upload a new SWF file that's what everybody sees. Here's a quick and easy way to do it.

The image below shows the File Resources section for the Staff Skills database that I've been talking about recently. Notice the multiple versions of the same SWF.

image 

Each time I recompile the app in Flex Builder I add a new File Resource and add a new version number to it.

Then, in the Form it lives in I update the value in a Computed For Display Field, called "FlexAppVersion", like below.

 image

This field is referenced directly in the two Computed Values you see above. Should all make sense. Rocket science it ain't.

Next time a user refreshes the page you're almost guaranteed they'll be getting the new version. Although there's always the chance their browser has cached the HTML itself. To check for this you can reference the version field in the page title as well, like below.

image

If what you expect people to see isn't what they say they're seeing then you can always ask them what they see in the title just to be sure!

Comments

  1. Nice tip! Thanks again.

    • avatar
    • Michael
    • Fri 9 Oct 2009 08:09 AM

    Why don't you leverage HTTP Cache directive ? Don't browser obey them when it's a swf file ?

    • avatar
    • Ferdy
    • Fri 9 Oct 2009 10:28 AM

    Jake,

    It is not rocket science, but I think this definitely is the best way to leverage caching whilst also forcing a fresh copy at times. Sites like Flickr do the exact same thing for their CSS file. They set the expiration date to many years ahead and include a version number in the filename like you do to force a fresh download when there is a new release.

    The only difference is that on most platforms you have automatic builds, so that a unique build number is automatically included and there are no manual actions to take. "Building" software for a release is quite a foreign concept in Domino apps, but all too common in .NET, Java and even scripting languages.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Fri 9 Oct 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content