From 044bd7909fe7601a63398bd4b4038608ba3c90e5 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 8 Jun 2023 18:29:14 -0400 Subject: static/js/update: Handle no cache --- assets/js/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'assets/js') diff --git a/assets/js/index.js b/assets/js/index.js index fc1f6c3..7be41db 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -81,10 +81,10 @@ const url = self.location.href.split("#")[0].split("?")[0]; check(url, "HEAD", function(request) { const local = document.querySelector('meta[name="last-modified"]').content; - const remote = request.getResponseHeader("last-modified") || local; + const remote = request.getResponseHeader("last-modified") || ''; const modified = Date.parse(document.lastModified) !== Date.parse(remote); - const drift = Date.parse(remote) - Date.parse(local); - if (modified) { + const drift = Date.parse(remote || local) - Date.parse(local); + if (remote && modified) { const indicator = document.querySelector("a[data-update]"); check(url, "GET"); indicator.href = url; -- cgit v1.2.3