Canvas toBlob is not recognized as a function in safari

canvas, html5-canvas, javascript, safari

Solution

I don't think the toBlob method is supported in Safari:

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#Browser_compatibility

According to this it's only available in Chrome 50+ and Firefox (19+ for basic support and 25+ for Image quality parameter) with some basic support in IE 10 and above.

So there's no support whatsoever for Safari.

Edit: According to the referenced URL support was added for the toBlob method in Safari 11 which came out on September 19th 2017

Problem

I am able to download an image in Chrome & Firefox using the code below but in Safari it's throwing this error: TypeError: 'undefined' is not a function (evaluating 'canvas.toBlob(blobCallback('wallpaperdeae'))') ``` $("#save").click(function(){ function blobCallback(iconName) { return function (b) { var a = document.getElementById('download'); a.download = iconName + ".jpg"; a.href = window.URL.createObjectURL(b); } } canvas.toBlob(blobCallback('wallpaperdeae')); }); ```

Original source