Page 1 of 1

No Cache Needed !!

Posted: Tue Mar 07, 2006 7:53 am
by d.shankar
Heloo all..

I need a great help.. My site uses flash and when i update the flash file and put it in the server and refresh again.. The same old flash file is being showed..[because the files are getting cached in the browsers history]

I have used many meta tags to avoid caching.. but it seems failing..

Anyone have idea to overcome this problem ?? Please help me guys...

Posted: Tue Mar 07, 2006 8:19 am
by Coditor
In these cases, I've always added a bogus parameter to the swf file, with a PHP random value:

src="myfile.swf?bogus=<?= mt_rand(1000, 9999) ?>"

That way it won't be cached. I know this sucks, but at least for development it helps.


Posted: Wed Mar 08, 2006 2:20 am
by revq
Your other option is to do a forced refresh - when you see the page hold down ctrl + F5, or hold down ctrl while clicking on the refresh button - it will reload the entire web site, ignoring anything in the cache. This isnt exactly something you can expect the public to do so for a live site, Coditor's suggestion is good - but for changes to a site still in development this should help.

Posted: Wed Mar 08, 2006 3:59 am
by Coditor
Unfortunately that doens't always work for Flash movies. It looks like the Flash plugin uses it's own cache... :(

Posted: Wed Mar 08, 2006 7:06 am
by d.shankar
hi coditor & revq,

Yeah u r right i too have used the rand?<php echo(... to load a new flash file..

but as revq said , ctrl+F5 thing.. but users dont do it normally..

tried many things in meta tag but it not helping guys ??

anyother help would be greatly appreciated !!!

Posted: Wed Mar 29, 2006 5:59 am
by sanketce
If your server supports PHP then try this in beginning...

use below code to disable caching:

Code: Select all

// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

Posted: Wed Mar 29, 2006 1:35 pm
by d.shankar
thanks sanket ...

i havent tried this.. will this work for all browsers ??

Posted: Thu Mar 30, 2006 1:28 am
by Coditor
All browsers should recognize those headers and ignore/disable cache. Still, I don't know if the flashplayer does.

Posted: Thu Mar 30, 2006 7:17 am
by d.shankar
yeah thats the thing..

the flash player is the problem ..

Posted: Thu Mar 30, 2006 9:06 pm
by sanketce
Sure this is server side code and supported by all browsers. Go ahead and check it out..