Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that http caching and sending 304 response is to save some bandwidth and of course some load time.

However in my web site there are about 40 css stylesheet files and 20 javascript files (don't ask me why)

I know that would be a great idea to combine most of them into one and reduce HTTP requests.

However my question is. Is there actually a way of caching when browser wouldn't even make requests for certain resources for some time? Because making requests and even getting 304 response is still some work.

share|improve this question

The best way is to set a max-age directive in the cache-control header. Specifically:

Cache-control: public,max-age=2592000

2592000 is the number of seconds you wish the file to be cached for (in this example it is 30 days ie 60x60x24x30).

Do note however, that many users visit websites with empty caches, so downloading all those files in the first place is a massive overhead. You should cut those down to at most 2 JS and 2 CSS files.

share|improve this answer

Yes, read this detailed article/video: https://developers.google.com/speed/articles/caching

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.