//头像
var urlcon = {url:“http://tx.haiqq.com/uploads/allimg/150401/200234AJ-5.jpg",type:"png”};
cc.loader.load(urlcon,function(err,texture){
if (err){
console.log("头像下载错误: " + err);
}
else{
var sp = new cc.SpriteFrame(texture);
headSp.spriteFrame = sp;
headSp.node.setContentSize(cc.size(90 , 90));
}
});
获取网络头像是上面的代码在模拟器上是正确的但是在网页webGl上提示没有跨域权限{
Access to Image at ‘http://tx.haiqq.com/uploads/allimg/150401/200234AJ-5.jpg’ from origin ‘http://localhost:7456’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:7456’ is therefore not allowed access.
}