使用websocket传图片报错 exception:Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’
Uncaught DOMException: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported
- 原因:利用本地HTML文档测试且图片来自本地
- 解决方法:将HTML文档和图片放置在web应用的资源路径下,如springboot项目中的
resources/static/
-
然后启动服务,通过
http:localhost:8080/SendPic.html
测试 -
其他情况
参考博客: https://www.cnblogs.com/Marydon20170307/p/10718495.html