Preventing Flex application caching in browser (multiple modules)

Posted by Simon_Weaver on Stack Overflow See other posts from Stack Overflow or by Simon_Weaver
Published on 2008-11-19T01:28:29Z Indexed on 2010/05/25 0:11 UTC
Read the original article Hit count: 670

Filed under:
|

I have a Flex application with multiple modules.

When I redeploy the application I was finding that modules (which are deployed as separate swf files) were being cached in the browser and the new versions weren't being loaded.

So i tried the age old trick of adding ?version=xxx to all the modules when they are loaded. The value xxx is a global parameter which is actually stored in the host html page:

var moduleSection:ModuleLoaderSection;
moduleSection = new ModuleLoaderSection();
moduleSection.visible = false;
moduleSection.moduleName = moduleName + "?version=" + MySite.masterVersion;

In addition I needed to add ?version=xxx to the main .swf that was being loaded. Since this is done by HTML I had to do this by modifying my AC_OETags.js file as below :

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf?mv=" + getMasterVersion(), "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

This is all fine and works great. I just have a hard time believing that Adobe doesn't already have a way to handle this. Given that Flex is being targeted to design modular applications for business I find it especially surprising.

What do other people do? I need to make sure my application reloads correctly even if someone has once per session selected for their 'browser cache checking policy'.

© Stack Overflow or respective owner

Related posts about flex

Related posts about caching