Website Cache?

Out of context: Reply #3

  • Started
  • Last post
  • 4 Responses
  • sublocked4

    Generally the way you deal with this is by explicitly serving resources like CSS and JS with the proper "expires" headers.

    http://stackoverflow.com/questio…

    However, since you can't ever control how each browser will react - the sure way is to use a random or sequential number appended to your CSS & JS files when referenced from HTML.

    Frameworks like Rails do this automatically, serving "new" versions of those resources after new deployments to the server.

    You can emulate this behavior by referencing something like /your-site/css/yourstyle.css?v=2...

    The server should just ignore the dynamic params, but browsers will see it as a new resource to fetch.

    • <<instrmntl
    • nicedbloc
    • Forgot in my hasty writeup that a simple datestamp for the dynamic parameter (miliseconds past epoch) will work just as well.sublocked

View thread