使用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