html2canvas.js not Working in IE9/10/11

2019-06-01 17:39发布

问题:

We want to capture screenshot of Div (HTML element) which is inside an IFrame. IFrame loads inside another Div at runtime in a html page. For capturing screenshot we are using html2canvas.js API.

Code is working very well with Mozilla and Chrome but not working in IE9/10/11.

The basic requirement is that to capture screenshot of Div and send that image byte-array to Flex application.

Function which captures screenshot is:

function capturImage() {
    html2canvas(document.getElementById('map_canvas'), {
        proxy: "server.js",
        useCORS: true,
        onrenderd: function (canvas) {
            var imageData = canvas.todataURL('image/png', 1.0);
            imageDataOnly = imageData.split(",");
            falshObj.getImage(imageDataOnly[1]);
        }
    });
}

Error In IE:

SCRIPT438: Object doesn't support property or method 'getComputedStyle' File: html2canvas.js, Line: 2269, Column: 5

Please let me know if anyone had similar experience or has any clue in resolving the issue.

回答1:

According to this gitHub issue (that seems to be filled by you), you should not use the proxy and the useCORS properties at the same time.