Blob createObjectURL download not working in Firefox (but works when debugging) Blob createObjectURL download not working in Firefox (but works when debugging) javascript javascript

Blob createObjectURL download not working in Firefox (but works when debugging)


You're probably removing the resource too soon, try delaying it

    ...    a.click();    setTimeout(function(){        document.body.removeChild(a);        window.URL.revokeObjectURL(url);      }, 100);  }


The above didn't solve the issue for me. But this one did instead:
Programmatical click on <a>-tag not working in Firefox
It was a problem with the triggering click event, not premature removal of the resource.


this solution works for me in bot chrome and firefox for existing anchor element to download binary file

window.URL = window.URL || window.webkitURL;var blob = new Blob([new Uint8Array(binStream)], {type: "octet/stream"});var link = document.getElementById("link");link.href = window.URL.createObjectURL(blob);