0

I am creating a speed test application which measures a users upload and download speed by timing how long it takes to upload and download various files. At the moment I am using Javascript to download an image from an external server using the following code:

var start_time,end_time;
var download = new Image();
download.onload = function () {
    end_time = (new Date()).getTime();
    download_duration = (end_time - start_time) / 1000;
    finish_download_test();
}
start_time = (new Date()).getTime();
download.src = 'www.fakeimage.com/image.jpg';

This works, however, I would like to display a progress bar whilst the image downloads. I have seen html5 and c# solutions, however, I would like something that is compatible for more browsers (so no html5) and I am using a combo of php and javascript so the c# solution doesnt help either.

Any help would be greatly appreciated, even if it was just a nudge in the right direction.

4

1 回答 1

0

您可以使用 flash 作为进度条。通过 flash 下载文件并通过 js 将百分比传递给 HTML 或仅使用 flash 显示。

于 2012-07-17T09:02:54.907 回答