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

前端 未结 3 1023
野性不改
野性不改 2020-12-04 17:31

I have an odd problem, the function below is one I created based on what i found on the net about creating a Blob in the client on the fly with some binary data in (passed a

3条回答
  •  无人及你
    2020-12-04 18:09

    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);
    

提交回复
热议问题