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

后端 未结 10 1652
天涯浪人
天涯浪人 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 13:53

    In the specs it says:

    Whenever the toDataURL() method of a canvas element whose origin-clean flag is set to false is called, the method must raise a SECURITY_ERR exception.

    If the image is coming from another server I don't think you can use toDataURL()

提交回复
热议问题