From b2496a771973942c8715aceaa2585f5b1d64e133 Mon Sep 17 00:00:00 2001 From: Leo Herzog Date: Mon, 22 Dec 2025 21:56:14 -0500 Subject: [PATCH] Remove Deprecated IE11 msSaveBlob Code --- src/parse.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/parse.js b/src/parse.js index 21c7820..fdfcc78 100644 --- a/src/parse.js +++ b/src/parse.js @@ -525,17 +525,13 @@ function getFilesFromPeers() { display(); } -// https://stackoverflow.com/a/36899900/2700296 function saveTorrent() { - let data = toTorrentFile(parsed); - if (data !== null && navigator.msSaveBlob) return navigator.msSaveBlob(new Blob([data], { type: 'application/x-bittorrent' }), parsed.name + '.torrent'); - let a = document.createElement('a'); - a.style.display = 'none'; - let url = window.URL.createObjectURL(new Blob([data], { type: 'application/x-bittorrent' })); - a.setAttribute('href', url); - a.setAttribute('download', parsed.name + '.torrent'); - document.body.appendChild(a); + const data = toTorrentFile(parsed); + const blob = new Blob([data], { type: 'application/x-bittorrent' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = parsed.name + '.torrent'; a.click(); - window.URL.revokeObjectURL(url); - a.remove(); + URL.revokeObjectURL(url); }