CSS文件名大小写敏感Css文件缓存 [英] CSS file name case sensitivity & Css file caching

查看:171
本文介绍了CSS文件名大小写敏感Css文件缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在重写我们的一些网站,并尝试为我们的用户最充分地使用浏览器缓存。我们已经创建了一组共享css文件,我们计划在我们创建的多个网站中用作公司品牌。

We are in the process of rewriting some of our websites and trying to make the most use of browser caching for our users. We have created a group of shared css files that we plan to use as a "corporate branding" across multiple sites that we've created.

这样做的原因知道浏览器将缓存一个CSS文件一个确定的时间长度。如果我在不同的站点使用不同的外壳指定相同的文件名,它将缓存文件的两个版本(即使它们是相同的内容),或者它将识别它是相同的文件,因此忽略文件名的情况

The reason for this, we know that browsers will cache a CSS file for a determined length of time. What if I specify the same file name in different sites with a different casing, will it cache both version of the file (even tho they are the same content) or will it recognize that it's the same file, thus ignoring the case of the filename


<link href="http://branding.corporateentity.com/style/screen.css" type="text/css" />
<link href="http://branding.corporateentity.com/style/print.css" type="text/css" />

vs:


<link href="http://branding.corporateentity.com/Style/Screen.css" type="text/css" />
<link href="http://branding.corporateentity.com/Style/Print.css" type="text/css" />


推荐答案

网址区分大小写,总是使用特定的情况。我建议使一切小写(和用短划线分隔词)为简单。

URLs are case-sensitive, so the best thing is to always use a particular case. I recommend making everything lowercase (and separating words with dashes) for simplicity. This is also recommended for your page names and images, for SEO purposes.

浏览器会将不同的案例视为不同的文件,因为他们不知道服务器是否正在执行相同。因此,如果浏览器看到 Style / Screen.css style / screen.css c>。

Browsers will treat different case as different files since they don't know whether the server is doing the same. Therefore, the browser will not use its cache of style/screen.css if it sees a link to Style/Screen.css.

这篇关于CSS文件名大小写敏感Css文件缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆