【发布时间】:2016-06-24 17:11:37
【问题描述】:
我的应用程序中有一个按钮,可将 html 元素导出为 png 文件。我通过使用 html2canvas.js 做到了这一点。它在 Google chrome 和 Mozilla firefox 浏览器中运行良好。但它在 Internet Explorer 中不起作用。当我在 IE 中单击该按钮时,它只是显示空白页。我在下面提供了代码。任何帮助表示赞赏。
$("#btnPng").click(function () {
$("#divPulledPopUpButtons").hide();
html2canvas($("#pulledPopUp"), {
onrendered: function (canvas) {
var url = canvas.toDataURL();
$("<a>", {
href: url,
download: "CAR.png"
})
.on("click", function () { $(this).remove() })
.appendTo("body")[0].click()
$("#divPulledPopUpButtons").show();
}
})
});
【问题讨论】:
标签: jquery html2canvas