Browse Source

Added property ignoreHTTPStatus. When set, the 'load' event handler will not check HTTP Status or readyState. Should only be used when XHRLoader fetch data from a non-http source (e.g. local file system, file://).

Pontus 9 years ago
parent
commit
6dddcfa03c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/loaders/XHRLoader.js

+ 9 - 1
src/loaders/XHRLoader.js

@@ -12,6 +12,8 @@ THREE.XHRLoader.prototype = {
 
 	constructor: THREE.XHRLoader,
 
+	ignoreHTTPStatus: false,
+
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		if ( this.path !== undefined ) url = this.path + url;
@@ -46,7 +48,7 @@ THREE.XHRLoader.prototype = {
 
 			THREE.Cache.add( url, response );
 
-			if ( this.status === 200 && this.readyState === 4 ) {
+			if ( ( this.status === 200 && this.readyState === 4 ) || scope.ignoreHTTPStatus ) {
 
 				if ( onLoad ) onLoad( response );
 
@@ -109,4 +111,10 @@ THREE.XHRLoader.prototype = {
 
 	}
 
+	setIgnoreHTTPStatus: function ( value ) {
+
+		this.ignoreHTTPStatus = value;
+
+	}
+
 };