prevent a new iframe being created for every download

This commit is contained in:
Bruno Windels 2020-11-23 10:28:20 +01:00
parent 669865f8db
commit 1c4818cf1d

View File

@ -20,7 +20,7 @@ export async function downloadInIframe(container, iframeSrc, blob, filename) {
iframe = document.createElement("iframe"); iframe = document.createElement("iframe");
iframe.setAttribute("sandbox", "allow-scripts allow-downloads allow-downloads-without-user-activation"); iframe.setAttribute("sandbox", "allow-scripts allow-downloads allow-downloads-without-user-activation");
iframe.setAttribute("src", iframeSrc); iframe.setAttribute("src", iframeSrc);
iframe.className = "hidden"; iframe.className = "hidden downloadSandbox";
container.appendChild(iframe); container.appendChild(iframe);
let detach; let detach;
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {