开发者

Browser caching of static resources (js, css): is it a real problem?

开发者 https://www.devze.com 2023-01-27 08:33 出处:网络
I wonder whether caching static resources by browsers (pretty much fresh: IE8, FF 3.6) is a real problem of development web application (when from time to time fresh version of webapp is going live an

I wonder whether caching static resources by browsers (pretty much fresh: IE8, FF 3.6) is a real problem of development web application (when from time to time fresh version of webapp is going live and development continues).

Taking into account that serving static content by server is c开发者_高级运维orrect in terms of appropriate headers (last-modified, etags and etc.) and response codes (304 when not modified and 200 with body when changes exist).

Can be there any situations when serving html is fresh, while static still taken from browser cache?


Unless you provide an Expires header, the browser should check for a new version each time the content is loaded, so it shouldn't be a problem (assuming the server gives the correct response).

But to be absolutely sure, you can give each version of your javascript/css a different filename, and change the filename in the HTML when you update. Then when the browser loads the HTML it will have to load the correct resources.

0

精彩评论

暂无评论...
验证码 换一张
取 消