BraydenMoore commited on
Commit
5d3e07e
·
1 Parent(s): 2fe8452

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +14 -3
templates/index.html CHANGED
@@ -172,9 +172,20 @@
172
  feed.src = "{{ url_for('static', filename='loading.gif') }}";
173
 
174
  const newUrl = "{{ url }}";
175
-
176
  function refreshImage() {
177
- img.src = newUrl + '?t=' + new Date().getTime();
 
 
 
 
 
 
 
 
 
 
 
178
  }
179
 
180
  const img = new Image();
@@ -186,7 +197,7 @@
186
  img.onerror = function() {
187
  window.location.href = "?new=true";
188
  };
189
-
190
  img.src = newUrl;
191
  });
192
 
 
172
  feed.src = "{{ url_for('static', filename='loading.gif') }}";
173
 
174
  const newUrl = "{{ url }}";
175
+
176
  function refreshImage() {
177
+ let xhr = new XMLHttpRequest();
178
+ xhr.open('HEAD', newUrl + '?t=' + new Date().getTime(), true);
179
+ xhr.onreadystatechange = function() {
180
+ if (xhr.readyState === 4) {
181
+ if (xhr.status === 200) {
182
+ if (xhr.getResponseHeader('Content-Type') === 'image/jpeg') {
183
+ img.src = newUrl + '?t=' + new Date().getTime();
184
+ }
185
+ }
186
+ }
187
+ };
188
+ xhr.send();
189
  }
190
 
191
  const img = new Image();
 
197
  img.onerror = function() {
198
  window.location.href = "?new=true";
199
  };
200
+
201
  img.src = newUrl;
202
  });
203