Three.js: FileLoader not working correctly in IE

Created on 9 May 2017  路  14Comments  路  Source: mrdoob/three.js

Description of the problem

Using the FileLoader with the Internet Explorer causes an Error, because other browser parse json files in the xhr request and the Internet Explorer does not.

My fix was replacing this line with:

if(event.target.responseType !== "json") {

    var response = JSON.parse(event.target.response);

} else {

    var response = event.target.response;

}
Three.js version
  • [x] Dev
  • [x] r85
  • [ ] ...
Browser
  • [ ] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [x] Internet Explorer
OS
  • [ ] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Bug

All 14 comments

What version of Internet Explorer are you using?

Here's the reference to the actual file: https://github.com/mrdoob/three.js/blob/master/src/loaders/FileLoader.js#L136

What version of Internet Explorer are you using?

Internet Explorer 11.0.9600.18426 (IE11)

@SoenkeHu Unfortunately, i'm unable to verify this bug because i have no IE11 around. Would you still mind to do a PR with the change? Maybe with a comment in the code that links to this issue?

I tried to load some three.js examples (which use FileLoader) with IE 11.1198.14393.0 and had no problems.

@jostschmithals Interesting. As far as i see you are using a higher IE11 version. Maybe this makes the difference...

Maybe.

I don't know, since I didn't really "use" IE before (the performance is really bad - in some cases I get only 1-2 FPS whereas Chrome makes 30 FPS on the same system).

I only tried to reproduce the described issue this evening (with the version shipped with the regular Windows update), since I couldn't imagine that such an issue, which would affect many of the examples, was not noticed before.

Maybe it was only a temporary bug in one IE version?

Maybe it was only a temporary bug in one IE version?

That may very well be.

@SoenkeHu Is it possible that you update your IE11 to a newer version?

It happens on two other machines too. (IE 11.1198.14393.0)

So the error that IE throws is

cannot read property "length" of undefined or null

in this line
but the problem is in the FileLoader, because the JSON doesnt get parsed in the FileLoader nor in IE (unlike other browsers).

The problem occured in the JSONLoader blender example

The problem does not exist in r84.

I assume this commit is the problem: e4feff113c3d7c56b44fef2f8798265c76b727c3. The change would explain the different behavior to r84.

@jostschmithals Can you also test with the mentioned JSONLoader example?

@Mugen87 yes. That is it. All examples using the changed loaders dont work in IE11.
uncomplete List of examples with that problem:

BufferGeometryLoader

JSONLoader

I think it should be handled in the FileLoader.
Maybe extend this if. That should fix it.

Indeed - I can confirm that these examples don't work in IE11 (yesterday I tested some different examples, since the original post was more unspecific).

Instead of adding new code, we maybe should revert e4feff113c3d7c56b44fef2f8798265c76b727c3. Let's wait what @mrdoob says.

@Mugen87 I guess I'll revert that commit 馃槆

Done! 49071e5a7770de3bf505705fc593abf2e13bc0af

Was this page helpful?
0 / 5 - 0 ratings