Skip to content

Commit

Permalink
Updated 似乎某些android不支持ajax progress特性
Browse files Browse the repository at this point in the history
  • Loading branch information
think2011 committed Nov 18, 2015
1 parent 86a8a49 commit 5d500e7
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,12 @@ document.querySelector('input').addEventListener('change', function () {
};

// issues #45 提到似乎有兼容性问题,关于progress
if (xhr.upload) {
try {
xhr.upload.addEventListener('progress', function (e) {
if (!e.lengthComputable) return false;

// 上传进度
progress.value = ((e.loaded / e.total) || 0) * 100;
});
} catch (err) {
console.error('进度展示出错了,似乎不支持此特性?', err);
}
}
xhr.addEventListener('progress', function (e) {
if (!e.lengthComputable) return false;

// 上传进度
progress.value = ((e.loaded / e.total) || 0) * 100;
});

// 添加参数
rst.formData.append('fileLen', rst.fileLen);
Expand Down

0 comments on commit 5d500e7

Please sign in to comment.