From 1870be87cb78c8130daaf0684cf4297ed586204d Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 13 Jun 2015 10:31:02 +0300 Subject: [PATCH] simple mjpeg cameras: prevent image caching --- static/js/frame.js | 4 +++- static/js/main.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/frame.js b/static/js/frame.js index 81fa55a..93ed060 100644 --- a/static/js/frame.js +++ b/static/js/frame.js @@ -82,7 +82,9 @@ function refreshCameraFrame() { if (cameraFrame.proto == 'mjpeg') { /* no manual refresh for simple mjpeg cameras */ - img.src = cameraFrame.url.replace('127.0.0.1', window.location.host); + var url = cameraFrame.url.replace('127.0.0.1', window.location.host); + url += (url.indexOf('?') > 0 ? '&' : '?') + '_=' + new Date().getTime(); + img.src = url; return; } diff --git a/static/js/main.js b/static/js/main.js index 0d6f09f..e3dccc8 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -3803,7 +3803,9 @@ function refreshCameraFrames() { if (!this.img) { this.img = $(this).find('img.camera')[0]; if (this.config['proto'] == 'mjpeg') { - this.img.src = this.config['url'].replace('127.0.0.1', window.location.host); + var url = this.config['url'].replace('127.0.0.1', window.location.host); + url += (url.indexOf('?') > 0 ? '&' : '?') + '_=' + new Date().getTime(); + this.img.src = url; } } -- 2.39.5