<a> 요소를 만들어서 클릭 이벤트를 트리거시켜 다운로드 하는 방식입니다.
var canvas = document.getElementById("somewhere")
canvas.toBlob(function(blob) {
var a = document.createElement("a")
document.body.appendChild(a)
a.style = "display: none"
blob.type = "octet-stream"
var url = URL.createObjectURL(blob)
a.href = url
a.download = "filename"
a.click()
window.URL.revokeObjectURL(url)
}





0개의 댓글