翻译自:html2canvas:proxy

Browse different proxies available for supporting CORS content
浏览可用于支持 CORS 内容的不同代理


html2canvas does not get around content policy restrictions set by your browser. Drawing images that reside outside of the origin of the current page taint the canvas that they are drawn upon. If the canvas gets tainted, it cannot be read anymore. If you wish to load images that reside outside of your pages origin, you can use a proxy to load the images.
Html2canvas无法绕过浏览器设置的内容策略限制(同源策略)。绘制跟当前站点不同源的图像时会污染在其上绘制的画布。如果画布被污染了就不能再阅读了(导致截图失败)。如果您希望加载不同源的图像,可以使用代理来加载图像。

可用代理 Available proxies

  • html2canvas-proxy 中间件

    Express中间件代理html2canvas

    html2canvas库版本需要>=v1.0.0
    安装:
    1. npm install html2canvas-proxy --save
    使用: ```javascript var proxy = require(‘html2canvas-proxy’); var express = require(‘express’);

var app = express(); app.use(‘/‘, proxy()); ```