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);