The operation is insecure.

  • 当我使用canvas的ctx.getImageData 方法时,js报错,错误是 The operation is insecure.


解决方案

<img src="..." crossOrigin="anonymous">

解决方案2

var img = new Image;

img.onload = loaded;            // load handler
img.crossOrigin = 'anonymous';
img.src = '...';