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'));
});
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With