1) I’m confused about the purpose of setting header expiry dates
for caching css and js files (like how it’s done in the
Boilerplate .htaccess file).
I thought web browsers automatically cache css and js files.
What’s the point of setting header expiry dates?
2) Is there a way to NOT use versioning of css and js files and
still have them automatically update when I upload them to a server.
I tried setting a lower expiry date (“access plus 1 week” and “access
plus 0 seconds”) and the browser was still displaying the old cached copy
when I uploaded updated css and js files. I’m not 100% sure I did this
correctly, though.
Thanks 🙂
1) Some browsers don’t cache things that do not have an expiration date.
2) Try appending a get variable to the end of your URL string to new versions of your website to ignore previous versions cache. The idea is to transform your urlstring into something like
www.example.com/?v=1and then when you change that towww.example.com/?v=2the browser does not recognize this url so it doesn’t use any cached files. When a user goes back towww.example.com/?v=2it will access the cached files forv2of your website