Logic Machine Forum
How to prevent cache of remote image? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: How to prevent cache of remote image? (/showthread.php?tid=5781)



How to prevent cache of remote image? - sgraystar - 09.12.2024

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() });
});



RE: How to prevent cache of remote image? - admin - 09.12.2024

Set refresh internal and an additional parameter to prevent caching will be added automatically.


RE: How to prevent cache of remote image? - sgraystar - 09.12.2024

OK, thanks.

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