سؤال

I am trying to take a screenshot of a div on my webpage using html2canvas.

In the html2canvas documentation it is stated that:

The script doesn't render plugin content such as Flash or Java applets. It doesn't render iframe content either, unless the content resides under the same origin.

My div contains same-origin iframes, but the iframes dont appear in the screenshot.

My script:

$('#savetopdf').click(function () {

       html2canvas($('#dashboard'), {
            "logging": true,
            onrendered: function(canvas) {
                var img = canvas.toDataURL()
                window.open(img);
            }
        });
    });
هل كانت مفيدة؟

المحلول

Unfortunately this is not implemented, any more.

I had the same issue and submitted it as a bug/feature request.

https://github.com/niklasvh/html2canvas/issues/376

The owner of the project stated:

niklasvh

There is currently no support for rendering iframe's even if the reside under same origin.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top