Remove Deprecated IE11 msSaveBlob Code

This commit is contained in:
Leo Herzog
2025-12-22 21:56:14 -05:00
parent 5791f8f749
commit b2496a7719

View File

@@ -525,17 +525,13 @@ function getFilesFromPeers() {
display(); display();
} }
// https://stackoverflow.com/a/36899900/2700296
function saveTorrent() { function saveTorrent() {
let data = toTorrentFile(parsed); const data = toTorrentFile(parsed);
if (data !== null && navigator.msSaveBlob) return navigator.msSaveBlob(new Blob([data], { type: 'application/x-bittorrent' }), parsed.name + '.torrent'); const blob = new Blob([data], { type: 'application/x-bittorrent' });
let a = document.createElement('a'); const url = URL.createObjectURL(blob);
a.style.display = 'none'; const a = document.createElement('a');
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/x-bittorrent' })); a.href = url;
a.setAttribute('href', url); a.download = parsed.name + '.torrent';
a.setAttribute('download', parsed.name + '.torrent');
document.body.appendChild(a);
a.click(); a.click();
window.URL.revokeObjectURL(url); URL.revokeObjectURL(url);
a.remove();
} }