'Are identical CSS files across separate websites shared/cached?
Let's say I have a website called http://example.com
. In my <head>
I have a stylesheet which is like so: <link rel="stylesheet" href="/_resources/css/style.css" />
What if I have another website called http://another-example.com/
and want to use the same stylesheet that I am using at http://example.com?
I am asking about load times. If someone visits example.com
first and then another-example.com
, if I have the stylesheet in another-example referencing the file in example, will their browser cache the stylesheet and not have to load it again, or will it just automatically download the example.com stylesheet when it visits another-example.com
and have two copies of the stylesheet?
Solution 1:[1]
In short, no. But do not worry, the time it takes to load a style sheet pales to the time it takes to load a single high quality image. This would only be an issue if somebody still using dialup at the 1kbs speed was trying to load your page.
You should also assume, when making a website, that things like caching is turned off. You can use the following code to force this.
Cache-Control: no-cache, no-store
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TylerH |