I am currently working on a online auction website (Sorry but I can not share the link here). On the list of products, our client want the product image to update dynamically via real time when modified from the back-end. The solution bellow does the trick:
var nocache = new Date().getTime();
$('#auction_id_' + aucId + ' img#' + imgID).attr("src", 'ItemPics/t' + new_image_url + '?' + nocache);
But when the user visits the product and then clicks on the back button to go back to the product list page - the cache of the product image is not cleared and the old image is back.
I can not disable the caching on the website since it causes too much loading on the client side.
(1) I have thought about creating a hidden iframe with the image as SRC and then refreshes during real time. (2) Simply reloading the page wont solve the problem so I also thought about manipulating a Ctrl + F5 using JavasSript to force request new image data when the users clicks on the back button = but I don't think any of these is the right way to do it.
Any ideas would be greatly appreciated, thanks!