frnhr
frnhr

Reputation: 12903

query parametar in image url

Is there a reason not to do this to force reload image in browser:

<img src="http://some.domain.com/the_image.jpg?v=3" />

The ?v=3 part, will it break somewhere?

Upvotes: 1

Views: 44

Answers (1)

sfussenegger
sfussenegger

Reputation: 36115

This is perfectly valid and often used together with aggressive client side caching. You could for instance use this URL together and let clients cache the image for a year (as suggested by some RFC as maximum) and change the value as soon as the_image.jpg changes.

Note however, that it's recommended to change the path rather than the query string instead (say /3/the_image.jpg, or the_image-3.jpg). This is mainly due to some faulty implementations (e.g. proxies).

Upvotes: 1

Related Questions