Is there any way to determine or force a CSS file to be re-cached if the user is operating off an old file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The single surest way to ensure that everyone reloads your new file is to change its URL. A reasonable way to do this without actually renaming it is to tack on a random string:
That’s using a sledgehammer to crack a nut, and bypassing all the HTTP mechanisms that exist to do this, but it will absolutely work everywhere, whereas the other techniques all have caveats.
Edit: @jitter: You don’t have to change the URL automatically for every request – you could base it on the timestamp of the CSS file, or even just change it by hand when you want to ensure that the CSS gets reloaded.