safari - Blob constructor

I am using the below code to open a local text file.It works fine in firefox but in safari i get the error as '[object BlobConstructor]' is not a constructor (evaluating 'new Blob([xhr.response])').please help me by providing links.

 var xhr = new XMLHttpRequest(),blob;
xhr.open('GET', 'example.txt');
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
blob = new Blob([xhr.response]);
console.log(blob);


            }

1 Answer

  1. Laurent- Reply

    2019-11-14

    It's a bug in the older Safari/WebKits. Upgrade your browser or operating system.

    Note: It still does not appear to accept ArrayBufferView's as arguments, but should be fine for normal arrays.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>