Tutorial :Clear my cache using cmd command=> ipconfig/dnsflush?



Question:

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?


Solution:1

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.


Solution:2

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »