1

I have a chrome app that blocks user's downloads and my code will instead download it in safe way. I want to download blob files with js; my code has worked fine until now, but I have found a blob link that my code fails on and I can't find why. Here is my code:

var request = new XMLHttpRequest();
request.open('GET', uri, true);
request.responseType = 'blob';
request.onload = function (evt) {
    var reader = new FileReader();
    reader.readAsDataURL(request.response);
    reader.onload = function (e) {
         var b64 = e.target.result.split("base64,")[1];
         var formData = new FormData();
    };
};

request.send();

My code based on this answer.

The file that I'm trying to download via js:

screenshot of a webpage with an arrow and hand-drawn circle pointing to the JSON download button

This is the website that contains the link

And here is the url link to the blob:

 blob:http://worldpopulationreview.com/b18cab08-e62e-47e5-8e31-413f2e73f72d

The error:

GET blob:http://worldpopulationreview.com/b18cab08-e62e-47e5-8e31-413f2e73f72d net::ERR_FILE_NOT_FOUND

Any ideas?

James Whiteley
  • 3,363
  • 1
  • 19
  • 46
spez
  • 409
  • 8
  • 21

1 Answers1

0

There error means that the file can not be found. This means that the address you are trying to download from doesn't exist on the website. Try accessing the page via your browser. Link to the page

You'll see that it returns a 404 error. This means that the URL does not exist. More info about error 404 here.

This error has nothing to do with your javascript code.

Pim
  • 554
  • 3
  • 12