一、问题
canvas.toDataURL()
报错如下:
1 |
Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported |
二、解决
图片设置 :crossOrigin属性
代码片段:img.setAttribute("crossOrigin",'Anonymous')
canvas.toDataURL()
报错如下:
1 |
Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported |
图片设置 :crossOrigin属性
代码片段:img.setAttribute("crossOrigin",'Anonymous')
公众号
头条号