How to use blob in safari 5.1

Does Safari for Windows (version 5.1) support Blob?

The following code example returns an error in the console:

var array=[1,2]; var aBlob = new Blob( array); 

Error:

"'[BlobConstructor object]' is not a constructor (evaluating 'new Blob (array)')"

How to fix it, if the safari does not support blob, then how to replace this

+5
source share
3 answers

Nope. Based on https://developer.mozilla.org/en/docs/Web/API/Blob supported with Safari 6.

EDIT: Obviously, MDN shows a way to use Blob without a constructor:

 var builder = new BlobBuilder(); var fileParts = ['<a id="a"><b id="b">hey!</b></a>']; builder.append(fileParts[0]); var myBlob = builder.getBlob('text/xml'); 
+2
source

You can enable blob-polyfill on your page and add a Blob constructor (and a new Blob(array) constructor) for older browsers. It will create Blobs using BlobBuilder, if available.

+2
source

Since Blobs are only supported by Safari 6+, you can try using an external library like Blob.js

Blob.js implements the W3C Blob interface in browsers that do not support it.

+1
source

Source: https://habr.com/ru/post/1245016/


All Articles