Fine Uploader 的 onProgress() 回调在 Android 设备上不起作用。这是我的代码:
onProgress: function(id, fileName, loaded, total)
{
//alert('debug'); this alert shows after download is completer
if (loaded < total) {
progress = '"' + fileName + '" uploaded ' + Math.round(loaded / total*100) +'%';
$('#progress').html(progress);
}
else {
$('#progress').html('saving');
}
}
onProgress() 在上传完成后调用。可能出现什么问题以及如何解决?
在 official docs它说:onProgress(String id, String name, int uploadedBytes, int totalBytes) - called during the upload, as it progresses. Only used by the XHR/ajax uploader.
最佳答案
经过一番挖掘后,我确定——截至撰写本文时——Android 4.0.4 的原生浏览器不完全支持 XMLHttpRequest specification 。具体来说,XMLHttpRequest 对象不会触发 ProgressEvents这对于确定当前上传文件的进度至关重要。
我尝试通过多种方式将事件处理程序绑定(bind)到 onprogress
事件,甚至遵循 Mozilla Developer Network article ,但无济于事。
onprogress
事件在 Android 版 Chrome 上正确触发。
我已提交 an issue in our tracker here 。希望能找到解决方法,或者谷歌等人。解决这个问题。
如果您有任何解决方法的建议,请随时分享
关于javascript - FineUploader onProgress() 回调不适用于 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17901630/