eli*_*ife 3 forms jquery plugins internet-explorer progress
我在我的项目中使用jQuery表单插件(jquery.form.js).它在Chrome/FF中工作正常,但在IE8/9中,没有调用uploadProgress回调.甚至官方网站http://jquery.malsup.com/form/progress.html上的演示也不会更新IE8/9中的上传进度.任何提示?谢谢.
从来源:
if (options.uploadProgress) {
// workaround because jqXHR does not expose upload property
s.xhr = function() {
var xhr = jQuery.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.onprogress = function(event) {
var percent = 0;
var position = event.loaded || event.position; /*event.position is deprecated*/
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
options.uploadProgress(event, position, total, percent);
};
}
return xhr;
};
}
Run Code Online (Sandbox Code Playgroud)
它使用ie8/9不支持的HTML5功能:
>> "upload" in new XMLHttpRequest
false
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2477 次 |
最近记录: |