The picture is placed on Youpaiyun. When canvas calls the picture, todataURl will report an error in the end. Is there any solution?
Baidu also looked at many solutions but none of them could be implemented. .
Error message:
Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
高洛峰2017-05-16 13:38:18
If it is new Image()
, add the following settings:
// 引用外部图片,需设置 crossOrigin 属性,否则 toDataURL 调用异常
image.setAttribute('crossOrigin', 'anonymous');
Reference question: /q/10...