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

后端 未结 10 1671
天涯浪人
天涯浪人 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:51

    Seems there is a way to prevent that if image hosting able to provide the following HTTP headers for the image resources and browser supports CORS:

    access-control-allow-origin: *
    access-control-allow-credentials: true

    It is stated here: http://www.w3.org/TR/cors/#use-cases

提交回复
热议问题