From d4a0af4142c685226ad54bdc50f2b8ceb516ffb7 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Wed, 21 Jun 2017 20:28:45 +0100 Subject: [PATCH] Synchronize with kiwix-js Former-commit-id: 02cd3ce8226c572e8a5ca2e2878b216f9c30673f [formerly 84ce9efc674825e14635c3d6d263e1219df0346c] Former-commit-id: 954ed180d739d1b91c2e7e45ebd44bc4d9083a01 --- www/js/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index 546d9590..6660e8a9 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -32,7 +32,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles // Disable any eval() call in jQuery : it's disabled by CSP in any packaged application // It happens on some wiktionary archives, because there is some javascript inside the html article // Cf http://forum.jquery.com/topic/jquery-ajax-disable-script-eval - /** This is not needed for UWP and seems to cause problems - GK jQuery.globalEval = function (code) { // jQuery believes the javascript has been executed, but we did nothing // In any case, that would have been blocked by CSP for package applications @@ -576,11 +575,13 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles var request = new XMLHttpRequest(); request.open("GET", url, true); request.responseType = "blob"; - request.onload = function (e) { - if (request.response) { + request.onreadystatechange = function () { + if (request.readyState === XMLHttpRequest.DONE) { + if ((request.status >= 200 && request.status < 300) || request.status === 0) { // Hack to make this look similar to a file request.response.name = url; setLocalArchiveFromFileList([request.response]); + } } }; request.send(null);