We've struggled with this issue *a lot*. Here is our final solution that seems
to have resolved the issue in a satisfactory way:
1. Our build environment renames the SWF to myapp_1_2_3_4.swf where 1.2.3.4 is
the current version number.
2. We define a variable at compile time that specifies the SWF version number
FlexBuilder: -define+=MYAPP::SWF_VERSION,'0.0.0.0'
Ant XML: <define name="MYAPP::SWF_VERSION" value="${SWF_VERSION}" />
Ant CMD: ant -DSWF_VERSION='%3' -f build.xml MYAPP
AS Code: var SWF_VERSION:String = MYAPP::SWF_VERSION
note: '%3' is a command line argument to a batch script that is called
by our build environment.
3. At load time, MYAPP.SWF makes a request to the server to get the expected
version of the SWF. If the value of SWF_VERSION does not match the version
returned by the server, we show an error that asks the user to refresh the
browser after clearing the cache. We also have a URL parameter,
skipVersionCheck to bypass the check if necessary, and we allow 0.0.0.0 as our
version number for debug builds.
On May 3, 2014, at 1:22 AM, Angelo Lazzari <[email protected]> wrote:
> Thanks Tomislav, i will give it a try.
>
> Angelo
>
>
> 2014-05-03 10:05 GMT+02:00 Tomislav Pokrajcic <[email protected]>:
>
>> You can enforce swf download (on each visit) by appending some random GET
>> parameter to the url (e.g. .../myapp.swf?rnd=some_random_value).
>>
>> Something less invasive would be to append a version number to a swf file
>> name (e.g. myapp_1_0_0.swf) and update the file name value in JavaScript
>> responsible for loading swf each time you update the version.
>> Filename can be stored in an external file that should be reloaded each
>> time (using the above metod). That's much cheaper operation than loading
>> the entire swf and deployment can be easily automated.
>>
>> Cheers,
>>
>> Tomislav
>>
>>
>> On 3.5.2014. 8:31, Angelo Lazzari wrote:
>>
>>> Hi everyone,
>>> i'm developing a web application with Apache Flex 4.12, so, to be clear,
>>> when my client access into his computer browser and write the application
>>> URL, he can login into the application.
>>>
>>> I need, obviously, to be sure my client is playing the last version i
>>> published.
>>>
>>> So, without creating complex version algorithms or so on, is there a way
>>> to
>>> force the swf download even if the browser has all the usual cache
>>> setting?
>>>
>>> Thanks
>>> Angelo
>>>
>>>
>>
>> ---
>> This email is free from viruses and malware because avast! Antivirus
>> protection is active.
>> http://www.avast.com
>>
>>