[removed] how to force Image() not to use the browser cache?

前端 未结 4 1586
执念已碎
执念已碎 2020-12-16 18:52

If I load the nextimg URL manually in the browser, it gives a new picture every time I reload. But this bit of code shows the same image every iteration of draw()

4条回答
  •  清酒与你
    2020-12-16 19:22

    You can't stop it from caching the image altogether within Javascript. But, you can toy with the src/address of the image to force it to cache anew:

    [Image].src = 'image.png?' + (new Date()).getTime();
    

    You can probably take any of the Ajax cache solutions and apply it here.

提交回复
热议问题