UI_SequentMicrosystems-RPI/wwwroot/DownloadFile.js

14 lines
446 B
JavaScript
Raw Normal View History

window.DownloadFile = function (fileName, content) {
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
// Po stisknutí tlačítka, odstraníme element a URL objekt
document.body.removeChild(a);
URL.revokeObjectURL(url);
};