有没有办法强制浏览器刷新/下载图像? [英] Is there a way to force browsers to refresh/download images?

查看:152
本文介绍了有没有办法强制浏览器刷新/下载图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,即用户报告说,他们的形象不被上载和旧的仍然存在。在仔细检查了新的图像在那里,他们只是有相同名称的旧的。我做上传的是,我重新命名图像搜索引擎优化的目的。当他们删除图像旧索引变得可用,并且重复使用。因此它具有相同的图像名。

I have a problem where users are reporting that their images aren't being uploaded and the old ones are still there. On closer inspection the new images are there, they just have the same name as the old one. What I do on the upload is that I rename the images for SEO purposes. When they delete an image the old index becomes available and is reused. Therefore it has the same image name.

有没有办法来(我想也许有可能是这个元标记)告诉浏览器不使用它的cahce?

Is there a way to (i thought maybe there might be a meta tag for this) to tell the browser to not use its cahce?

更好的答案是将图像重命名为全新的东西。我会的工作之上,但在平均时间是快速的解决方案,而我在更大的问题的工作。

The better answer is to rename the image to something totally new. I will get working on that but in the mean time is the quick solution while I work on the bigger problem.

推荐答案

添加一个随机数查询字符串(或时间,或版本号等):

append a querystring with a random number (or time, or version number, etc.):

<img src="image.png?80172489074" alt="a cool image" />

这将导致因为不同的文件名中的一个新的请求,网址

this will result in a new request, because of the different filename URL

这篇关于有没有办法强制浏览器刷新/下载图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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