在浏览器中防止Flex应用程序缓存(多个模块) [英] Preventing Flex application caching in browser (multiple modules)
问题描述
当我重新部署应用程序时,我发现模块(作为单独的swf文件部署)被缓存浏览器和新版本没有被加载。因此,我尝试了在加载时向所有模块添加?version = xxx
的古老技巧。值 xxx
是一个全局参数,它实际存储在host html页面中:
var moduleSection:ModuleLoaderSection;
moduleSection = new ModuleLoaderSection();
moduleSection.visible = false;
moduleSection.moduleName = moduleName +?version =+ MySite.masterVersion;
另外,我需要添加?version = xxx
到正在加载的主要.swf。由于这是由HTML完成的,我必须通过修改我的AC_OETags.js文件来做到这一点,如下所示:
pre $函数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);
}
这样很好,效果很好。我很难相信Adobe还没有办法来处理这个问题。鉴于Flex正在为设计业务模块化应用程序而设计,我觉得这一点特别令人惊讶。
其他人做什么?我需要确保我的应用程序能够正确地重新加载,即使有人为每个会话选择了一次,以便为其浏览器缓存检查策略选择
理想情况下,这个应该是平台所照顾的,但是那里没有快乐。但是,这对我们来说非常合适,而且很容易与哈德森的自动化版本集成到一起 - 目前还没有任何抱怨。
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'.
I had a similar problem, and ended up putting the SWF files in a sub-directory named as the build number. This meant that the URL to the SWF files pointed to a different location each time.
Ideally this should be catered for by the platform, but no joy there. But this works perfectly for us, and integrates very easily into our automated builds with Hudson - no complaints so far.
这篇关于在浏览器中防止Flex应用程序缓存(多个模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!