views:

195

answers:

3

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.

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" />
A: 

URL's are case sensitive, and browsers follow that standard- a different case is a different file. I would hesitate to use the example above however, because some browsers may not follow the standard protocall (for example, i think Windows is not case sensitive, and wonder if some sad old browsers can't tell the difference between 'file' and 'File').

superUntitled
A: 

The browsers will always differentiate between different casing in URLs, as some web servers return different results for different casing.

Windows web servers doesn't care about the casing, but Linus servers do. If the file was on a Linux server you would get an HTTP 404 using the wrong casing.

Guffa
My desktop is Windows but my server is Linux. Every now and then I've gotten burned when a graphics program writes a file with extension ".JPG" but my links are written as ".jpg". It works fine when I test it on Windows, but when I upload to Linux, 404. Deliberately messing with mixed case is just setting yourself up for trouble.
Jay
+3  A: 

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.

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.

DisgruntledGoat