html2canvas代码无法运行IE 11 [英] html2canvas code not working IE 11

查看:796
本文介绍了html2canvas代码无法运行IE 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用html2canvas库来制作一个div的图像并将其放入另一个div中。到目前为止,我在Safari,Chrome和Firefox中运行得非常好,但不是IE(11是我现在唯一关心的版本)。

I am hoping to use the html2canvas library to make a image of one div and put it in another. So far I have it working wonderfully in Safari, Chrome, and Firefox but not IE (11 is the only version I care about right now).

我正在使用它来自另一个Stackoverflow问题的来自这个jsfiddle的代码:

I am applying it using the code from this jsfiddle from another Stackoverflow question:

var aaaDiv=document.getElementById('aaa');
var ttDiv=document.getElementById('tt');

html2canvas(aaaDiv).then(function(canvas) {
// assign id:avatarCanvas to canvas 
canvas.id='avatarCanvas';
// append canvas to ttDiv
ttDiv.appendChild(canvas);

});

https://jsfiddle.net/m1erickson/wtchz972/

我听说IE不喜欢'appendChild',但我不确定如何从那里继续。

I heard IE doesn't like to 'appendChild', but I am not sure how to proceed from there.

推荐答案

appendChild函数与您面临的问题无关。自IE6 +以来一直支持appendChild

The appendChild function has nothing to do with the issue you're facing. appendChild has been supported ever since IE6+

通过查看html2canvas代码,该库恰好使用了 Promises功能,遗憾的是在任何版本的IE中都不支持

By looking at the html2canvas code, the library happens to make use of the Promises feature which unfortunately is not being supported in any version of IE

http://caniuse.com/#search=promises

(虽然Microsoft Edge支持)

(though it is supported in Microsoft Edge)

这篇关于html2canvas代码无法运行IE 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆