This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to prevent cache of remote image?
#1
Ubiquiti cameras have an anonymous mode that allows an instantaneous snapshot via url. Is there a way to prevent caching of the image so that it reloads every time the page/plan is opened?

Modifying the query parameter to the url does not appear to prevent caching of this snapshot from a doorbell camera. The image only loads once on browser reload, not each time the page/plan is opened.

Element: Image
Image source: Remote
Image url: http://192.168.1.17/snap.jpeg
Refresh interval: blank
Additional classes: nocache

Custom javascript

Code:
$(function(){
  $('.nocache').find('img').attr('src', function () { return $(this).attr('src') + "?a=" + performance.now() });
});
Reply
#2
Set refresh internal and an additional parameter to prevent caching will be added automatically.
Reply
#3
OK, thanks.

I also realised just now that using a frame instead of an image also achieves the desired result.
Reply


Forum Jump: