xdiepx Posted July 3, 2014 Share Posted July 3, 2014 I made this patch that overrides the default behavior in the json loader, and then i works in ie,just put it in a file and load it after pixi PIXI.JsonLoader.prototype.load = function () { var scope = this; scope.ajaxRequest = {}; $.get(this.url).done(function (data) { scope.ajaxRequest.responseText = JSON.stringify(data); scope.onJSONLoaded(); }).fail(function () { scope.onError(); })} Oh I just reverted it back to the previous version of pixijs and hoping it is fixed for the next version. And your patch works really well thanks . Quote Link to comment Share on other sites More sharing options...
mrBRC Posted July 3, 2014 Share Posted July 3, 2014 (edited) ^^^^^^^^^^ can't seem to remove this quote block ^^^^^^^^^^^^^^^^^^^^^ hmm,, you shouldn't need to stringify your json.. for it should not be text/plain... the request contentType and response contentType should be 'application/json' EDIT: actually, what I said here doesn't really make sense.. of course you want to stringfy the object to text, if you want text.. but I would have thought you should just be putting that object into the response object after declaring the responseType to be json.. but it seems responseType json is not supported on webkit (though I see some conflicting information on that).. you could go the contentType = 'blob' route.. or bufferArray.. but I suspect onJSONLoaded() isn't suited to handle that as of yet... reference: http://www.html5rocks.com/en/tutorials/file/xhr2/ EDIT (again).. post editing issues.. whiping out my content Edited July 3, 2014 by mrBRC Quote Link to comment Share on other sites More sharing options...
mrBRC Posted July 3, 2014 Share Posted July 3, 2014 how are yall testing your applications (development environment).. through localhost.. or are you attempting to run it from your filesystem 'file:\\\C:/path/file.html'? Quote Link to comment Share on other sites More sharing options...
mrBRC Posted July 3, 2014 Share Posted July 3, 2014 (edited) you need to add "Access-Control-Allow-Origin" to your server response headerthe wildcard * should suffice.. I set my actual domain though 'http://www.iakarra.net' and for the xhr object.. PIXI.AjaxRequest = function(){ var activexmodes = ['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.3.0', 'Microsoft.XMLHTTP']; //activeX versions to check for in IE if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++) { try{ //console.log("ActiveXObject used"); return new window.ActiveXObject(activexmodes[i]); } catch(e) { //suppress error //console.log("ActiveXObject Error"); } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc { var xhr = new XMLHttpRequest(); xhr.setRequestHeader("Origin",window.domain); return xhr; } else { return false; }};additionally.. I set the src attribute of my scripts to be "application/x-javascript" calls (though that probably doesn't matter).. but my server seems to resolve the response contenttype of .js files to that, so I might as well have the request be uniform. EDIT: oh.. the console.log in the ActiveXObject are not part of this solution (I commented them out in this edit)..since I'm testing IE emulations I figured I would track this through my tests.. feel free to remove those lines altogether Edited July 3, 2014 by mrBRC Quote Link to comment Share on other sites More sharing options...
mrBRC Posted July 4, 2014 Share Posted July 4, 2014 I looked into this a bit more, and it seems the JsonLoader is attempting to use XDomainRequest.. which apparently has issue with same origin calls.. so a domain check is probably in order.. http://stackoverflow.com/questions/18624746/ie-xdomainrequest-cors-issue Quote Link to comment Share on other sites More sharing options...
nate55 Posted January 15, 2015 Share Posted January 15, 2015 if your font file is using an xml format, like if it was built with bmfont, adding text/xml as the mime type of .fnt to your server should fix it. worked for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.