How does JSF cache CSS?

I have 2 CSS files as shown below. style.css gets 304 Not Modified. But default.css always gets 200 OK. Why is default.css not cached?

<h:outputStylesheet library="css" name="default.css"/> <h:outputStylesheet library="css" name="style.css"/> 
+7
source share
2 answers

I tried to include some external CSS files in XHTML. I always use a basic approach to embed CSS in XHTML. I am inserting the following lines on the index page of your project. It always works fine.

 <link rel="stylesheet" type="text/css" href="file1.css" /> <link rel="stylesheet" type="text/css" href="file2.css" /> 
0
source

It is possible that the default.css style is provided by the server with some kind of document title that prevents caching. This may be beyond your control, but if you cannot find out if the server has any specific rule through htaccess or another configuration that prevents browser caching (or caching for a very short time).

If default.css is a dynamically generated document, the header can also be created dynamically by the language that creates the actual css document on the server.

There are tools like Fiddler and browser plugins like Live HTTP Header that let you check the file headers requested by the browser.

Caching can also be disabled in the browser itself, but if two unique files with the same extension act differently, this is probably not a browser setting.

0
source

All Articles