图片访问报Tainted canvases may not be exported

因为图片跨域访问导致,修改方案:在图片服务器上的nginx时增加配置:

add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

在前端使用:
image.crossOrigin = 'Anonymous';
或者
<img  crossorigin="anonymous">

猜你喜欢

转载自www.cnblogs.com/yifamily/p/11645686.html