From 22b94bcc3463366c8ad27c33272fe4594a69dc69 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 May 2018 19:25:38 +0300 Subject: mention the reason for resource loader; check for response statuses --- read.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'read.html') diff --git a/read.html b/read.html index eaa9861..cf1095e 100644 --- a/read.html +++ b/read.html @@ -259,6 +259,8 @@ } $(document).ready(function() { + // we need to preload resources for reader iframe because it can't utilize our + // service worker because while offline it is created outside our base server context var res_names = [ "lib/bootstrap/v3/js/jquery.js", "lib/jquery.mobile.custom.js", "css/transitions.css", "js/reader.js", "css/reader.css", "js/dict.js", @@ -266,7 +268,7 @@ for (var i = 0; i < res_names.length; i++) { fetch(res_names[i], {credentials: 'same-origin'}).then(function(resp) { - resp.text().then(function(data) { + if (resp.status == 200) resp.text().then(function(data) { _res_data[resp.url] = data; }); }); -- cgit v1.2.3