I currently have a caching problem on my flash site.

I have set the htaccess file to:

Header set Cache-Control "no-cache"

But when I refresh the page, the images on the flash site still shows the old one from the cache.

I also tried setting max age to 1, and to must-revalidate, but it doesn't work too.

I have also tried adding that line of code to my php index file, but it doesn't work either.

Could this be a fault with flash? I tried shift+refresh in Firefox, but the files are still cached, as shown in firebug. Is there a way to fix this?

Recommended Answers

All 5 Replies

You'll need to change the header of the flash file, something like this should work:

<FilesMatch "\.swf$">
Header set Cache-Control "no-cache, max-age=0, must-revalidate"
</FilesMatch>

Hello,

I did that, but it still doesn't work. Any ideas why?

Well, browsers can choose themselves what to do. As flash files are often big and don't change often, they might use their cache anyway. But why is this important? If, for example, the data you want to use in a flash thing changes often, you'll need to put that data in a seperate file (xml or csv or whatever) and have flash use that, rather than putting it inside the flash file.

That is what I did, all the data is in an xml file. The flash file simply holds the site design.

I have new images that simply don't update.

Could it be my host though?

Well, the thing is, that the browser when it got the file in the first place, decided not to get it another time soon, based on the headers it had. You can test in another browser that doesn't have it cached (or just clear the cache, whatever) to open the page, change the flash file, and reload, to see if your new headers do their job.
Also, in Firebug or the Chrome Developer Tools, you can see if the browser has downloaded the file, also check if it does if it hasn't changed. It shouldn't.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.