javascript - Fixing cross domain issues on a 360 canvas createjs gallery -
i trying fix cross domain errors on example
http://cssdeck.com/labs/ze8jtaqe
^ using old version of easiljs lib - tried start updating lib - breaks application.
if loading images cross-domain, taint canvas. since loading them images (tag loading), can @ least loaded , displayed despite being on different domains.
if using xmlhttprequests (or xhr, preloadjs uses default), fail load entirely. in case recommend people use tag loading in preloadjs loadqueue (as @theoldcountry said above).
to load images easeljs stage, , interact stage (including mouse interactions, filters, etc), image must include cross-origin response header (more info on cors here). once served, must set crossorigin
property on image:
var image = new image(); image.crossorigin = "anonymous"; image.src = "http://etc.png";
without crossorigin property, errors in canvas, , without server providing cors header, different error, same result.
note preloadjs supports cors well, can pass crossorigin flag item loaded server cors:
loadqueue.loadfile({src:"http://server.com/image.png", crossorigin:true});
here quick fiddle made time ago show custom filters in easeljs uses image on test server supports cors.
hope helps.
Comments
Post a Comment