javascript HTML 5 的 BlobBuilder() 在 Google Chrome 中是否仍然有效?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14527820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 21:51:56  来源:igfitidea点击:

Does HTML 5's BlobBuilder() still work in Google Chrome?

javascripthtmlgoogle-chromeblob

提问by user2011958

Based in this article http://cloudevils.wordpress.com/2012/10/18/ajax-file-upload-without-post-using-html5/I created a form to upload files. Initially works fine in chrome but now is not workin more. In FF work fine. I made some debugs and this line

基于这篇文章http://cloudevils.wordpress.com/2012/10/18/ajax-file-upload-without-post-using-html5/我创建了一个表单来上传文件。最初在 chrome 中工作正常,但现在不再工作了。在FF工作正常。我做了一些调试和这一行

var bb = new (window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder)();

seems stop working in chrome. Browsering around I find some info about BlobBuilder() function that is not supported more in chrome.

似乎停止在 chrome 中工作。浏览我发现一些关于 BlobBuilder() 函数的信息,在 chrome 中不受更多支持。

Can help me?

可以帮我?

回答by Adam

It's gone or deprecated. Use the new Blob constructor.

它已消失或已弃用。使用新的 Blob 构造函数。

Read: http://updates.html5rocks.com/2012/06/Don-t-Build-Blobs-Construct-Them

阅读:http: //updates.html5rocks.com/2012/06/Don-t-Build-Blobs-Construct-Them

In your tutorial instead of:

在您的教程中而不是:

var bb = new (window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder)();
bb.append(data);
var blob = bb.getBlob();

Do:

做:

var blob = new Blob([data]);