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?
如果我的计算机是多个实时网站的Web服务器,如果我在命令提示符编辑器中键入ipconfig / dnsflush会有什么危害吗?
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.
我总是遇到这个问题。我在.html文件中嵌入了flash(swf)。每当我更新swf时,.html文件总是使用旧的swf,即使我清除了我的缓存和其他任何东西。
Is there any ways to have my .html file always get the latest/updated swf file?
有没有办法让我的.html文件始终获取最新/更新的swf文件?
2 个解决方案
#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:
键入ipconfig / dnsflush将无法解决您的问题,即刷新DNS缓存,您的问题是浏览器正在缓存您的SWF文件。有几种方法可以阻止这种情况。最简单的方法可能是在EMBED / OBJECT标记中的SWF文件的URL上添加一个随机查询字符串:
<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.
但请注意,这意味着您的SWF将每次都重新下载,而不会从浏览器缓存中重新下载。如果您不想这样做,请考虑在查询字符串中添加版本号而不是随机数,并在希望客户端下载新的SWF文件时将其递增。
#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.
我有一个小的PHP片段,我用来附加unixtime,当我将文件上传到闪存'url末尾的服务器。这样我只需上传新的一个,所有内容都会自动排序。
#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:
键入ipconfig / dnsflush将无法解决您的问题,即刷新DNS缓存,您的问题是浏览器正在缓存您的SWF文件。有几种方法可以阻止这种情况。最简单的方法可能是在EMBED / OBJECT标记中的SWF文件的URL上添加一个随机查询字符串:
<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.
但请注意,这意味着您的SWF将每次都重新下载,而不会从浏览器缓存中重新下载。如果您不想这样做,请考虑在查询字符串中添加版本号而不是随机数,并在希望客户端下载新的SWF文件时将其递增。
#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.
我有一个小的PHP片段,我用来附加unixtime,当我将文件上传到闪存'url末尾的服务器。这样我只需上传新的一个,所有内容都会自动排序。