How to force a web browser NOT to cache images

Armin Ronacher has the correct idea. The problem is random strings can collide. I would use:

<img src="https://stackoverflow.com/questions/126772/picture.jpg?1222259157.415" alt="">

Where “1222259157.415” is the current time on the server.
Generate time by Javascript with performance.now() or by Python with time.time()

Leave a Comment