如何防止某些背景图像缓存

问题描述:

添加一些随机数是可行的,但仅适用于img

adding some random number it works, but only for img

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

有什么方法可以防止缓存prp. background-image?

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

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

相同的技术将在其中起作用.

The same technique will work there.

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

假定您的服务器在该GET参数的作用下没有任何不同.

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.