Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent some background-images caching

adding some random number it works, but only for img

<img src="example.jpg?377489229" />

Is there any way to prevent caching prp. background-image?

<div style="background-image: url(example.jpg  )"></div>"

1 Answers

The same technique will work there.

<div style="background-image: url(example.jpg?377489229)"></div>

Assuming your server doesn't act differently with the presence of that GET param.

This will only break the cache once though, if you want it to always hit the server, you will need to use some different techniques.

like image 99
alex Avatar answered Jan 22 '26 03:01

alex