Why does canvas.toDataURL() throw a security exception?

后端 未结 10 1548
天涯浪人
天涯浪人 2020-11-22 12:56

Did I not get enough sleep or what? This following code

var frame=document.getElementById(\"viewer\");
frame.width=100;
frame.height=100;

var ctx=frame.getC         


        
10条回答
  •  难免孤独
    2020-11-22 14:00

    Finally i found the solution. Just need add the crossOrigin as third param in fromURL func

    fabric.Image.fromURL(imageUrl, function (image) {
                //your logic
        }, { crossOrigin: "Anonymous" });
    

提交回复
热议问题