开发者

IE is not refreshing images with out restart [PHP solution]

I am building a site in php. I was trying to allow users to change their profile image. But in internet explorer new im开发者_如何学编程age is not showing up..IE still shows old image. It will show new image only if I close and open the browser. URL for this image is always same. How do I invalidate IE cache,,,"Cache-Control: no-cache" is not working.


depending on how often you need your image updated, whether it be once or many times you can set some jscript up to load the image src = http://imgurl.jpg?randomnumber and that will refresh your image, you just then put it on a timer in your jscript, and you use the onload and on error events. best part is none of the images need to be renamed, you need to simply draw a new random number with your jscript and reload the url for the image


One garanteed way you could do that is to rename the image everytime its uploaded (assuming you keep the file name in some sort of database). So since the image name always changes ie(or any browsers) will redownload it everytime.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜