Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

javascript - Safari浏览器无法将Canvas toBlob识别为功能(Canvas toBlob is not recognized as a function in safari)

I am able to download an image in Chrome & Firefox using the code below but in Safari it's throwing this error:

(我可以使用以下代码在Chrome和Firefox中下载图片,但在Safari中会抛出此错误:)

TypeError: 'undefined' is not a function (evaluating 'canvas.toBlob(blobCallback('wallpaperdeae'))')

(TypeError:'undefined'不是一个函数(评估'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'));

});
  ask by Bikshu s translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...