html2canvas не захватывает внешнее изображение внутри div - PullRequest
0 голосов
/ 14 апреля 2019

html2canvas не захватывает внешнее изображение внутри div.Я где-то нашел, что allowTaint: true может решить проблему.но все равно получаю пустое изображение. пожалуйста, помогите

код

$(document).ready(function() {

$("#capture").click(function(){

    html2canvas($('#preview-container').get(0),{ allowTaint: true }).then( function (canvas) {
   // console.log(canvas.toDataURL());
   dataURL= canvas.toDataURL('image/jpeg', 0.9).split(',')[1];

        $.ajax({
        url: 'https://api.imgur.com/3/image',
        type: 'post',
        headers: {
            Authorization: 'Client-ID ***********'
        },
        data: {
            image: dataURL
        },
        dataType: 'json',
        error:function(response){

        console.log(response);

        },
        success: function(response) {
            if(response.success) {
                alert(response.data.link);
                window.location = response.data.link;

            }
        }
    });
 });

   });
 });
...