summaryrefslogtreecommitdiff
path: root/src/scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/main.js')
-rw-r--r--src/scripts/main.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/scripts/main.js b/src/scripts/main.js
index e4efee0..091a3d2 100644
--- a/src/scripts/main.js
+++ b/src/scripts/main.js
@@ -1,5 +1,17 @@
+function urlExists(url) {
+ var http = new XMLHttpRequest();
+ http.open('HEAD', url, false);
+ if (http.status != 200)
+ console.log(`${http.status} ${url} `)
+ http.send();
+ return http.status != 404;
+}
+
if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
+ for (var i = 0; i < assets.length; i++) {
+ urlExists(assets[i]);
+ }
navigator.serviceWorker
.register("scripts/service-worker.js")