Jump to content

AssetLoader IE10&9


FraukeVdz
 Share

Recommended Posts

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 :D.

Link to comment
Share on other sites

^^^^^^^^^^ 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 by mrBRC
Link to comment
Share on other sites

you need to add "Access-Control-Allow-Origin" to your server response header

the 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 by mrBRC
Link to comment
Share on other sites

  • 6 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...