问题
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).
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!
回答1:
First, you can try to clear browsers cache or open you page in other browser to see if it works.
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.
回答2:
the best way to upload image is between < fugure >< /figure > and the most important tag is < img > in which your image goes
<figure><img src="image_name.jpg"></figure>
来源:https://stackoverflow.com/questions/20028324/html-i-upload-new-image-to-site-old-image-still-loads