Is there a way to make sure that a certain background image recently updated does appear in its last version on everybody's browser (rather than the old version stored in cache)?
It has to be a solution not involving touching the line of code calling the CSS (I could put a question mark and a version number after the css file name, like : <link href="styles.css?v=2" rel="stylesheet" type="text/css"/>
, but in this case I don't have access to this part of the code)
You can use the following approach:
.button {
background: url(../Images/button.png?v=1234);
}
You can add another CSS rule after the other CSS, that overrides the rules that loads the image and uses an image with an added version number.
CSS rules loaded later have higher priority, so you can use the same selector as in the main CSS, and it will override it.
If you can't do that, then you are screwed. You have to change the URL of the image that is loaded to surely get the new image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With