This issue has also worried me (a lot). My approach: I also change the swf file name as you do. Then I manually update the Main.html file to refer to the new swf file name. The Main.html file name doesn't change. I place the files on the server.
I change my .htaccess file as follows: # ------------------------------------------------------------------------------ # | Set Cache-Control | # ------------------------------------------------------------------------------ # Cache-Control no-cache means: If you want to use a cached copy of this in future, you must first # check with me that it is up-to-date (i.e. perform revalidation) # https://developers.google.com/speed/docs/best-practices/caching?csw=1#LeverageBrowserCaching # note: mod_headers is installed by default <FilesMatch "\.(html|swf|pdf)$"> <IfModule mod_headers.c> Header set Cache-Control "no-cache, public" </IfModule> </FilesMatch> I'm no expert here, but I'm led to believe this code will force the .html and .swf files to re-download when newer versions are on the server compared to client cache. It seems to work in Chrome, IE 10, FF. This way, you don't need to request user to refresh cache manually. As I'm no expert here, I'd be interested for people to either poke holes in this approach or confirm it's a valid method. For completeness, I also include the following in .htaccess: # ------------------------------------------------------------------------------ # | Expires headers (for better cache control) | # ------------------------------------------------------------------------------ # Far-future expires headers (for better cache control) # 10/20/2013 See: http://www.extravision.com/blog/whats-wrong-caching # http://httpd.apache.org/docs/2.2/mod/mod_expires.html # http://stackoverflow.com/questions/9933012/how-to-use-mod-headers-and-mod-expires-to-cache # https://developers.google.com/speed/docs/best-practices/caching?csw=1#LeverageBrowserCaching # Chrome and IE don't obey cache-busting arguments to ends of URLs unless this added. # note: mod_expires is installed by default <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 month" # CSS, read it like: expire css files after 1 month in the client's cache ExpiresByType text/css "access plus 1 year" # Data interchange ExpiresByType application/json "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds" # Favicon (cannot be renamed!) ExpiresByType image/x-icon "access plus 6 months" # HTML components (HTCs) ExpiresByType text/x-component "access plus 6 months" # HTML ExpiresByType text/html "access plus 0 seconds" # JavaScript ExpiresByType text/javascript "access plus 6 months" ExpiresByType application/javascript "access plus 6 months" ExpiresByType application/x-javascript "access plus 6 months" # Flash ExpiresByType application/x-shockwave-flash "access plus 6 months" # PDF ExpiresByType application/pdf "access plus 6 months" # Manifest files ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" ExpiresByType text/cache-manifest "access plus 0 seconds" # Media ExpiresByType audio/ogg "access plus 6 months" ExpiresByType image/gif "access plus 6 months" ExpiresByType image/jpeg "access plus 6 months" ExpiresByType image/jpg "access plus 6 months" ExpiresByType image/png "access plus 6 months" ExpiresByType image/ico "access plus 6 months" ExpiresByType video/mp4 "access plus 6 months" ExpiresByType video/ogg "access plus 6 months" ExpiresByType video/webm "access plus 6 months" # Web feeds ExpiresByType application/atom+xml "access plus 1 hours" ExpiresByType application/rss+xml "access plus 1 hours" # Web fonts ExpiresByType application/font-woff "access plus 6 months" ExpiresByType application/vnd.ms-fontobject "access plus 6 months" ExpiresByType application/x-font-ttf "access plus 6 months" ExpiresByType font/opentype "access plus 6 months" ExpiresByType image/svg+xml "access plus 6 months" </IfModule> ----- Original Message ----- From: "Jesse Ward-Karet" <[email protected]> To: "users, apache" <[email protected]> Sent: Monday, May 5, 2014 12:34:45 PM Subject: Re: Force last SWF downloading 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 >> >>
