1

I have to handle kind of large data sets with plain text. I get these data via a cloud as several chunks and use a web worker to process and format the data. In the end, I want to download it to the user's local storage. Therefore, I'm using Blobs and saveAs() defined in FileSaver.js to grant cross-browser compability. I want to send a reference to the final data via URL.createObjectURL and pass the URL's DOMString back to my main thread. This works very well in Chrome or Edge, but IE11 makes some problem. If I console.log the retrieved URL, Chrome and Edge give me the following result:

blob:"reference to website"/"XXXX-XXXXX-XXXXX-XXXX"

But if I do the same in IE11, I get the following result:

blob:"XXXX-XXXXX-XXXXX-XXXX"

Here is an example code: https://jsfiddle.net/BoesingaGit/Lvx20uj8/6/ I don't use a web worker here, because the problem also exists without it. Sadly, the saveAs function doesn't work in JSFiddle, but it does at my regular code. In Chrome the download of the url would work, but it doesn't in IE. If you take a look at the console, you can see that the URL is different in Chrome and IE. I guess this results in the failed download in IE. Is there a reason, why in IE there is no reference to my website?

Thanks.

  • I suggest you provide any sample code. It can help us to understand the issue in a better way. Only description of the issue is not giving the idea about the cause of the issue. Thanks for your understanding. – Deepak-MSFT May 04 '20 at 12:18
  • Thanks for the advise. I added some sample code. I hope you guys can understand my problem better now. – BoesingaGit May 05 '20 at 15:00

1 Answers1

0

I check the issue and make some research about it.

I found that BLOB URLs do not work in the IE browser for security reasons.

To work around the issue you can try to use msSaveOrOpenBlob() method

Example code:

    var str = "Hello World";
    blobObject = new Blob([str], {type: "plain/text"});
    $(button).click(function(){
        window.navigator.msSaveOrOpenBlob(blobObject, filename);
    });

References:

  1. Open links made by createObjectURL in IE11

  2. Blob url in internet explorer with angularjs

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • Thanks for your answer and the references. The work around would lead to another problem in my case. I am using the web worker to keep data intensive processes out of my main thread. The work around would mean, that I have to send the blobObject (which contains lots of data) back to my main thread. This would slow down or even stop the web page. That's why I wanted to use the URL to only send a reference back to the main thread. – BoesingaGit May 11 '20 at 07:55
  • I understand your problem but due to some security reasons the IE browser has a limitation and this is the only workaround I got to make it work in the IE browser. Thanks for your understanding. – Deepak-MSFT May 11 '20 at 10:43