Search code examples
javascriptcssbrowser-cache

Do dynamically-added CSS files get cached by the browser?


When I dynamically create a link element, and add it to the head to add a CSS file to a web page, does that file get cached?

Secondly, if it doesn't get cached, is there any way for me to have it get cached?

I'm asking browser side, if I can instruct the browser to cached the file?


Solution

  • It does get cached. You can control caching by modifying your site's .htaccess file.

    http://www.askapache.com/htaccess/apache-speed-cache-control.html