防止图像被缓存在浏览器中 [英] Preventing Images being cached in the browser

查看:81
本文介绍了防止图像被缓存在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个浏览图片功能,其中有缩略图,当用户单击时它会展开。

I have a feature of "Browse Pictures" where there are thumbnails and when a user clicks it expands.

现在,这两个图像都存储在单独的虚拟目录中使用不同的尺寸,较大的为200 * 200像素。

Now, both these images are stored in separate virtual directories with different sizes, the larger being 200*200 px.

不过,当我单击放大时,它仅显示较小的图像,而不是200 * 200的图像。 / p>

Still it only shows the smaller image when I click it to enlarge, instead of the 200*200 images.

推荐答案

您可以向图像的 href 添加随机URL参数,因此呈现的HTML看起来像是

You can add a random URL parameter to the image's href, so that the HTML rendered looks like

<img src="http://static.example.com/some/large/image.jpg?234234652346"/>

而不是

<img src="http://static.example.com/some/large/image.jpg"/>

这篇关于防止图像被缓存在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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