javascript html2canvas 不捕捉图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27754544/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 07:57:04  来源:igfitidea点击:

html2canvas not capturing image

javascriptjqueryhtmlhtml2canvas

提问by Karthikeyan

html2canvas.js not capturing image. it leaves white space where the image occurs.

html2canvas.js 不捕获图像。它在图像出现的地方留下空白。

function capture()
{
    html2canvas(document.body, {
        allowTaint: true,
        logging:true,
        onrendered: function(canvas) {
        imagestring = canvas.toDataURL("image/png");
        console.log(imagestring);
        document.body.appendChild(canvas);
        }
    });
}

I have tried a lot but i cannot find solution .

我已经尝试了很多,但我找不到解决方案。

Help is appreciated :)

帮助表示赞赏:)

回答by Karthikeyan

It works, when I host it in the server. The security restrictions causes it to fail.

当我将它托管在服务器中时,它可以工作。安全限制导致它失败。