html2canvas 截图 图片为空白 无法截图
SouerBo:
您好,我在本地的图片也无法截取到是什么原因呢?
下列方程是一元一次方程的是( )
A、x2+2x=3 B、1/x-5=x C、x-y=0 D、x=1
D
html2canvas(document.getElementById("box1"), {
useCORS: true, //是否跨域
allowTaint: true,
taintTest: false,
background: "#ffffff", //背景
height: $("#box1").outerHeight(),
width: $("#box1").outerWidth(),
onrendered: function (canvas1) {
url = canvas1.toDataURL('image/jpeg', 1.0); //将图片转为base64, 0-1 表示清晰度。默认为 image/png
$("#img1").attr("src", url)
img = new Image();
img.src = url;
img.setAttribute("crossOrigin", 'Anonymous'); //避免跨域调用图片而作的防范
img.onload = function () {
|