HTML-我将新图像上传到网站,但仍会加载旧图像 [英] HTML - I upload new image to site, old image still loads

查看:71
本文介绍了HTML-我将新图像上传到网站,但仍会加载旧图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Linux脚本,该脚本每小时都会从我的网站下载一张图片,但是当我更改图片时(通过上传具有相同名称的新图片),例如www.mywebsite.com/images/myimage.jpg,旧副本会继续下载.是否需要一定的时间?我使用MyDomain.com作为托管网站,并使用其FileManager上传新图片(但它将覆盖保持不变的旧图片).

I am running a linux script that downloads a picture from my website every hour, but when I change the image (by uploading a new one with the same name), such as www.mywebsite.com/images/myimage.jpg , the old copy keeps getting downloaded. Is there a certain amount of time it takes? I use MyDomain.com as my hosting website and use their FileManager to upload a new picture (but it overwrites the old one keeping the same name).

有关如何处理此问题的任何提示?即使在Web浏览器中(与我的linux wget命令相对),即使上传使用干净的浏览器并进行私有浏览,旧图片仍然在上传后仍然存在,因此我认为这与浏览器缓存无关.

Any tips on how to handle this? Even in a web browser (opposed to my linux wget command) the old picture is still there after uploading, even using clean browsers with private browsing so I don't think it has to do with browser cache.

感谢您抽出宝贵的时间阅读本文,并感谢您的帮助!

Thanks for taking the time to read this and thanks for any help!

推荐答案

首先,您可以尝试清除浏览器缓存或在其他浏览器中打开页面以查看其是否有效.

First, you can try to clear browsers cache or open you page in other browser to see if it works.

第二,您可以在'?'之后添加一些假值.登录图片scr网址:

Second, you can add some fake values after '?' sign in image scr url:

<img src="path-to-your-imge/sameName.jgp?anyValueHere123" alt="" >

每次加载具有相同名称的新图像时都对其进行更改,在这种情况下,浏览器将不使用缓存来显示该图像或者您可以在隐身窗口中打开它.

Chnge it every time when new image with same name is loaded an in this case browser will not use cache to show that image or you can open it in incognito window.

这篇关于HTML-我将新图像上传到网站,但仍会加载旧图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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