diff options
author | tdro <tdro@noreply.example.com> | 2023-06-08 18:29:14 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-06-08 18:29:14 -0400 |
commit | 044bd7909fe7601a63398bd4b4038608ba3c90e5 (patch) | |
tree | d0fb8062e0779812dcfe515993f68db086f73f29 /assets/js | |
parent | fb3eedd51abb47b5421928b27d6deae16a5ed263 (diff) | |
download | canory-044bd7909fe7601a63398bd4b4038608ba3c90e5.tar.gz canory-044bd7909fe7601a63398bd4b4038608ba3c90e5.tar.bz2 canory-044bd7909fe7601a63398bd4b4038608ba3c90e5.zip |
static/js/update: Handle no cache
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/index.js | 6 |
1 files changed, 3 insertions, 3 deletions
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; |