0
不工作
我寫這段代碼這是工作完美的谷歌Chrome和Opera,但不工作的Firefox:D3圖表圖像下載在Firefox
function download()
{
var canvas = document.createElement("canvas");
var svg=document.getElementsByTagName('svg')[0];
svg1 = $(svg).parent().html();
canvg(canvas, svg1);
var obj=document.getElementsByTagName("canvas");
var a = document.createElement('a');
// toDataURL defaults to png, so we need to request a jpeg, then convert for file download.
a.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
a.download = 'chart.jpg';
a.click();
}
有什麼不對?請指導我。