html2canvas not capturing image

Karthikeyan picture Karthikeyan · Jan 3, 2015 · Viewed 12.3k times · Source

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

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 :)

Answer

Karthikeyan picture Karthikeyan · Jan 5, 2015

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