Tainted canvases may not be exported

后端 未结 10 1332
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 05:21

I want to save my canvas to a img. I have this function:

function save() {
    document.getElementById(\"canvasimg\").style.border = \"2px solid\";
    var d         


        
10条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 06:17

    In my case I was drawing onto a canvas tag from a video. To address the tainted canvas error I had to do two things:

    
    
    • Ensure Access-Control-Allow-Origin header is set in the video source response (proper setup of crossdomain.example.com)
    • Set the video tag to have crossorigin="anonymous"

提交回复
热议问题