Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
const canvas = document.querySelector("#canvas"); // берём канвас
canvas.toBlob(blob => { //Переводим в блоб
// Делаем специальную ссылку
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = "canvas.png"
document.body.appendChild(a);
// кликаем по ссылке
a.click();
//убираем
window.URL.revokeObjectURL(url);
a.remove();
});
I have a sketch
On lines 16-19, a downloader link is created and on line 32 it is attached to a button, or whatever you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question