Browse Source

this fixes #13, hopefully

pull/2/head
gorhill 10 years ago
parent
commit
b946a96bb6
  1. 10
      src/js/assets.js

10
src/js/assets.js

@ -212,14 +212,20 @@ var cachedAssetsManager = (function() {
/******************************************************************************/ /******************************************************************************/
var getTextFileFromURL = function(url, onLoad, onError) { var getTextFileFromURL = function(url, onLoad, onError) {
var onResponseReceived = function() {
if ( typeof this.status === 'number' && this.status >= 200 && this.status < 300 ) {
return onLoad.call(this);
}
return onError.call(this);
};
// console.log('assets.js > getTextFileFromURL("%s"):', url); // console.log('assets.js > getTextFileFromURL("%s"):', url);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'text'; xhr.responseType = 'text';
xhr.timeout = 15000; xhr.timeout = 15000;
xhr.onload = onLoad;
xhr.onload = onResponseReceived;
xhr.onerror = onError; xhr.onerror = onError;
xhr.ontimeout = onError; xhr.ontimeout = onError;
xhr.open('get', url, true);
xhr.send(); xhr.send();
}; };

Loading…
Cancel
Save