iFrame is not coming in screenshot - HTML2Canvas

2019-06-11 15:19发布

问题:

I have tried many times for capturing iframe into screenshot using Html2Canvas. But not coming and except iFrame everything is coming.

I have one web page with bootstrap menu and simple iframe. I want to take full page screen on button click.

May i know what step i missing in code implementation.

  <input type="button" id="btnCapture" value="Capture" />

<script>
     $("#btnCapture").on("click", function () {
                captureAndUpload();
            });

    function captureAndUpload() {
            html2canvas(document.body, {
                onrendered: function (canvas) {
                    $.ajax({
                        url: "@Html.Raw(Url.Action("Action", "Controller"))",
                        data: { 'capturedShot': canvas.toDataURL("image/png") },
                        type: "POST",
                        dataType: "json",
                    success: function (result) {
                        alert("ScreenCaptured");
                    },
                    error: function () {
                        alert("fail");
                    }
                });
                }
            });
        }

<script>

You're answer will appreciable.

回答1:

It says in their documentation that iframes are not supported:

The script doesn't render plugin content such as Flash or Java applets. It doesn't render iframe content either. Blockquote