How can I make sure and be sure that my webpage isn't cached?

流过昼夜 提交于 2019-12-11 11:59:09

问题


I have a problem with .css files not being updated while I change it, and everything points to caching. I have cleared browser cache, added versioning, or even changed the link to another .css file, but nothing helped.

There are two subquestion:
a) what else can I do about caching issues?
b) when can I be sure that every possible solution was tested and not working, so it's highly unlikely that the problem is in caching?

Both .php and .css files are on localhost, in XAMPP sandbox - when the previous options failed, I suspect the problem might be either in Apache or in any other part of XAMPP, or that Firefox treats it somewhat special for not being in the "real internet", and thus didn't remove cache for it despite advertising "no cache".

EDIT: I use Firefox 21.0. I tried the same under Google Chrome 27.0.1453.116 m, with no effect too.

EDIT2: the original question was resolved, and it proved NOT to be about caching. Just in case it would help anyone in the future, I add a brief list of related questions and accept the answer that adds something new to their answers:

Stylesheet not updating

Firefox browser does not reload the update CSS/JS files

What is an elegant way to force browsers to reload cached CSS/JS files?

Making sure a web page is not cached, across all browsers

And, finally, one from super user:

Config xampp never to cache pages from localhost


回答1:


Have you tried modifying the cache control in the htaccess file?

Try this

http://www.chicagostyleseo.com/2010/04/googles-need-for-speed-use-cache-and-htaccess-to-speed-up-your-site/

This has the cache control code for your hit access file




回答2:


This is one of the best article available to prevent CSS Caching
Can We Prevent CSS Caching?
Update on CSS Caching



来源:https://stackoverflow.com/questions/17331351/how-can-i-make-sure-and-be-sure-that-my-webpage-isnt-cached

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!