0

If my computer is the web server for multiple live websites, is there any harm if I type ipconfig/dnsflush in my command prompt editor?

I always got this problem. I embed a flash (swf) in a .html file. Whenever I update the swf, the .html file always use the old swf even if I clear my cache and whatever else.

Is there any ways to have my .html file always get the latest/updated swf file?

blahdiblah
  • 33,069
  • 21
  • 98
  • 152

2 Answers2

3

Typing ipconfig/dnsflush won't fix your problem, thats flushing the DNS cache, your problem is that your SWF file is being cached by the browser. There are a few ways to stop this. The easiest is probably by adding a random query-string onto the URL of the SWF file in the EMBED/OBJECT tag:

<script type="text/javascript">
<!--
document.write('<object etc ... ');
document.write('<param name="movie" value="filename.swf?r=' + Math.round(Math.random() * 99999) + '">');
document.write(' the other param tags here );
document.write('<embed src="filename.swf?r=' + Math.round(Math.random() * 99999) + '" etc .... </embed>');
document.write('</object>');
//-->
</script> 

But be aware that this means your SWF will be downloaded afresh every time, and never from the browser cache. If you don't want this, consider adding a version number in the querystring rather than a random number, and increment this when you want clients to download a new SWF file.

JonoW
  • 14,029
  • 3
  • 33
  • 31
0

I have a little php snippet that I use to append the unixtime of when i uploaded the file to the server at the end of the flash' url. This way I just upload the new one and everything sorts itself out automagically.

grapefrukt
  • 27,016
  • 6
  • 49
  • 73