Skip to content

Commit 44f9b10

Browse files
authored
Allow XHR status 0 as success too
Normally only status 200 would be accepted as success, but 0 is returned when a file is loaded from the local filesystem (file://). This happens for example when opening the index.html of a (Phaser) game in a browser directly, or, as it turns out, when using Cordova on iOS. This fixes phaserjs#3464
1 parent 4c25d12 commit 44f9b10

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/loader/File.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ var File = new Class({
315315
*/
316316
onLoad: function (xhr, event)
317317
{
318-
var success = !(event.target && event.target.status !== 200);
318+
var success = !(event.target && (event.target.status !== 200 && event.target.status !== 0));
319319

320320
// Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
321321
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599)

0 commit comments

Comments
 (0)