Explorar el Código

fixed cache issue with xhr

Andrew Tridgell hace 4 años
padre
commit
10c65a8576
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      templates/generate.html

+ 6 - 0
templates/generate.html

@@ -31,6 +31,12 @@
             output.scrollTop = output.scrollHeight;
             var xhr = new XMLHttpRequest();
             xhr.open('GET', "{{apache_build_log}}");
+
+            // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
+            xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
+            xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
+            xhr.setRequestHeader("Pragma", "no-cache");
+
             xhr.onload = function() {
                 if (xhr.status == 200) {
                     output.textContent = xhr.responseText;