Page 1 of 1

refresh cache

Posted: 15 Jul 2018, 12:30
by zanico
Hi Karl,
we have a webcam that every two minutes uploads via ftp of a photo (webcam.jpg) to a gallery folder
the problem is that the x3 engine does not notice that the photo has changed, and always displays the old image from the cache. it is updated only by pressing f5 from the keyboard
is there any way to force the photo without taking it from the cache?

this is the page
http://www.parmasoaring.it/webcam/

Re: refresh cache

Posted: 15 Jul 2018, 23:29
by mjau-mjau
X3 does not "cache" images (only stores resized images). It is not the "X3 engine" that does not detect that image has changed, but your browser does not detect it. The reason you are not seeing updated image, is because your server is set to include "cache headers" for all images, so that browsers are told to cache the image. This is correct, as you SHOULD have images set to cache. Imagine if your visitors had to reload all the same images each time they visit the website?
Image
http://www.parmasoaring.it/content/web- ... webcam.jpg

Solution
What you are trying to do there is not really a functional way to create a "live update". You can't really tell browsers "don't cache this image, but cache all the others". If I was you, I would use a short javascript for that page, to inject the image dynamically, with random url parameters?12345 to force the image to always be loaded fresh from server.

Let me know if you need help with the above.