how to stop FLEX from caching?

不打扰是莪最后的温柔 提交于 2020-01-03 05:52:27

问题


i'm working with a flex app I didnt design myself, in fact i really don't know much about the workings of flex. I want to disable all caching since its causing a lot of problems since we changed to a new payment method.

I know the disabling cache isnt ideal, but it just needs to be done for the moment. I found a server side solution for this, but my implementation of it doesn't seem to work.

i tried setting it in the header, here's the piece of code for my index.html

<head>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...........

Maybe someone with experience on this matter is willing to help be out?


回答1:


A Flex application is in fact just a Flash file, which is a file with the .swf extension. Just like any other asset in a web page, you can make it reload simply by changing the filename. The best thing you can do, is to include a build number in that filename.

Suppose at the moment the file is called MyApp.swf, you could rename it to MyApp-2.0.swf and just change the build number whenever you publish a new version.
Another option would be to pass the build number as a URL paramter like so: MyApp.swf?v=2.0, but in my experience that's slightly less reliable.

Also don't forget that the server might cache the entire page. If that's the case, it would keep loading the old MyApp.swf, even if you changed the name. How to prevent this, depends on the server side language.



来源:https://stackoverflow.com/questions/11139521/how-to-stop-flex-from-caching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!