如何防止某些背景图像缓存 [英] How to prevent some background-images caching

查看:96
本文介绍了如何防止某些背景图像缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

添加一些随机数是可行的,但仅适用于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.

这篇关于如何防止某些背景图像缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆