为什么Firefox的缓存有时我的CSS和放大器; JavaScript的code,即使它已经改变? [英] Why does Firefox sometimes cache my CSS & Javascript code, even though it has changed?
问题描述
在我的产品网站,火狐有时犯规检测在我的CSS和放大器的变化; JavaScript的code。相反,它加载旧版本,这样看来,我需要清除缓存。在这样的情况下,我该怎么办?这涉及到最新的Firefox(16.0.1在写这篇文章的时间。)
编辑!
我忘了说了它的本地主机css文件错误。我的意思是,那里有一个古老的js文件,我更新,上传,并在产品服务器的Firefox认为它的本地主机文件。
该方法包括我的文件:
<链接rel =stylesheet属性HREF =/ xyz.css类型=文/ CSS/>
如果您使用的是服务器端语言,你可以使用一个小技巧。
您可以附加的CSS / .js文件后的字符串。在PHP中,例如:
<链接rel =stylesheet属性类型=文/ CSS的href =/ style.css中T =<?=时间();?>中/>
它改变了每个页面重新加载。
看看这篇文章的缓存无效。
On my product site, Firefox sometimes "doesnt detect" changes in my CSS & Javascript code. Rather it loads the old versions, so it seems that I need to clear the cache. In a situation like this, what should I do? This relates to the latest Firefox (16.0.1 at the time of this writing.)
EDIT!
I forgot to say it mistakes for the localhost css files. I meant, theres an old js file, I update it, upload it, and on product server firefox thinks its the localhost file. The way I include files:
<link rel="stylesheet" href="/xyz.css" type="text/css" />
If you are using a server-side language you could use a trick. You can append a string after .css/.js. In PHP for example:
<link rel="stylesheet" type="text/css" href="/style.css?t=<?= time(); ?>" />
It changes every page reload.
Take a look at this article about cache busting.
这篇关于为什么Firefox的缓存有时我的CSS和放大器; JavaScript的code,即使它已经改变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!