A project using the Canvas canvas label HTML5, canvas display of the image from the api.xx.com this subdomain, the current page of the domain is m.xx.com, once through the JS to call: Canvas.todataurl (), will report cross-domain issues:
Redirect at Origin ' http://api.xx.com ' have been blocked from loading by cross-origin Resource sharing Policy:no ' access-c Ontrol-allow-origin ' header is present on the requested resource. Origin ' http://m.xx.com ' is therefore not allowed access.
May I ask if there is a solution to the cloud, or can I add a head access-control-allow-origin open control over the cross-domain request for pictures?
How do I add access-control-allow-origin to the head of the requested picture?
Reply content:
A project using the Canvas canvas label HTML5, canvas display of the image from the api.xx.com this subdomain, the current page of the domain is m.xx.com, once through the JS to call: Canvas.todataurl (), will report cross-domain issues:
Redirect at Origin ' http://api.xx.com ' have been blocked from loading by cross-origin Resource sharing Policy:no ' access-c Ontrol-allow-origin ' header is present on the requested resource. Origin ' http://m.xx.com ' is therefore not allowed access.
May I ask if there is a solution to the cloud, or can I add a head access-control-allow-origin open control over the cross-domain request for pictures?
How do I add access-control-allow-origin to the head of the requested picture?
Previously encountered this problem, but also the sub-domain name of different cross-domain, because the use of the picture is not on the same server.
The solution adopted at that time was to get the picture file content through the server, and then output the HTML page, which would solve the cross-domain problem of the picture. (but maybe irrelevant!) )
Plusimg.crossOrigin = "Anonymous"
Access-Control-Allow-OriginThis stuff was sent backstage.
I've had this problem before, but I didn't do it, because for some other reason, you can only discard the image from the server and change it to local