Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBJ impoter does not work in IE - see fix #500

Open
7 tasks
AdamMcM opened this issue Aug 20, 2016 · 0 comments
Open
7 tasks

OBJ impoter does not work in IE - see fix #500

AdamMcM opened this issue Aug 20, 2016 · 0 comments

Comments

@AdamMcM
Copy link

AdamMcM commented Aug 20, 2016

Description of the problem

Loading OBJ files in IE (in my case IE 11) causes a state exception in the Ajax request object. This occurs when, the xhr is set to "arraybuffer". This is a known problem in IE. The work around is to not set xhr to "arraybuffer", but keep its default as "text". Download the file as a string, and then convert it to an arraybuffer before passing it to ok()

Here is the full load() function with comments at the changes.

   function load(url, ok, error) {
            var xhr = new XMLHttpRequest();
            //xhr.responseType = "arraybuffer";  // *** CHNAGED

// xhr.addEventListener('progress',
// function (event) {
// // TODO: Update the task? { type:'progress', loaded:event.loaded, total:event.total }
// }, false);
xhr.addEventListener('load',
function(event) {
if (event.target.response) {
var s = event.target.response; // *** CHANGEs HERE!!!
var uintArray = new Uint8Array(s.split('').map(function(char) {return char.charCodeAt(0);}));
ok(uintArray);
} else {
error('Invalid file [' + url + ']');
}
}, false);
xhr.addEventListener('error',
function() {
error('Couldn't load URL [' + url + ']');
}, false);
xhr.open('GET', url, true);
xhr.send(null);
}
})();

SceneJS version
  • Dev
  • [x ] Master
  • ...
Browser
  • [] All of them
  • Chrome
  • Firefox
  • [ x] Internet Explorer
OS
  • [] All of them
  • [ x] Windows
  • Linux
  • Android
  • IOS
Hardware Requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant