how to clear or replace a cached image

后端 未结 20 1648
囚心锁ツ
囚心锁ツ 2020-11-29 02:04

I know there are many ways to prevent image caching (such as via META tags), as well as a few nice tricks to ensure that the current version of an image is shown with every

20条回答
  •  鱼传尺愫
    2020-11-29 02:31

    Try this code snippet:

    var url = imgUrl? + Math.random();
    

    This will make sure that each request is unique, so you will get the latest image always.

提交回复
热议问题