0
我想使用HTML2Canvas來抓取div的內容並將其保存爲圖像。這在Firefox中完美運行,但Chrome瀏覽器正在拋出一個錯誤。我在我的build.js文件上面包含了HTML2Canvas JS文件。HTML2Canvas - Chrome問題 - 未定義
我使用的代碼如下:單擊按鈕時
function genImage(callback) {
// Hide the Plus + Minus Buttons
$('.expandImage').hide();
$('.shrinkImage').hide();
html2canvas($(".templateDesign"), {
onrendered: function(canvas) {
canvas.toBlob(function(blob) {
var formdata = new FormData();
formdata.append("image", blob);
return $.ajax({
url: "imageupload.php",
type: "POST",
data: formdata,
processData: false,
contentType: false
}).success(callback);
});
}
});
}
運行該功能。正如我所說,它在Firefox中完美運行。但在Chrome中,我收到以下錯誤:
Uncaught TypeError: undefined is not a function build.js:234html2canvas.onrendered build.js:234o.complete html2canvas-min.js:2o html2canvas-min.js:1e.onload html2canvas-min.js:1
任何想法爲什麼Chrome不工作,但FireFox是?