Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find percentage of file downloaded

Status
Not open for further replies.

jcnes

Programmer
Apr 3, 2005
1
US
Hi all,
I'm wanting to make a download progress bar with javascript that actually measures the percentage of the file that's being loaded. My question is:
Are there any functions in JS that can extract the total size of the file and the currently downloaded size of a file. Flash has functions such as getBytesTotal() and getBytesLoaded() to measure these types of statistics for a downloading movie clip. Setting aside the logistical problems of having a progress bar appear before the page loads, am I foolish in hoping that there is some sort of JS mechanism for measuring a file's vital signs?
 

am I foolish in hoping that there is some sort of JS mechanism for measuring a file's vital signs?

Yes :eek:)

Realistically, you would only be able to do this for any generic file with server-side support, and much overhead (client talking back to server every update interval, communicating how much data had been sent of the total count).

Much, much, much more hassle that its worth, IMHO.

There is a slim chance it would be possible with the xml http control, although I really don't know enough about it to say whether or not it has methods that would be practical to implement your needs.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
I don't know of any JavaScript that can do this, but I've used ActiveFile before and it works pretty good (assuming that your users will agree to install it).

Adam

Whatever I feel like I wanna do, gosh!
 
Like adam0101's link, such a feature is gonna require something more than just basic javascript. In addition to adam0101's solution, I suspect that you could also retreive the information in Firefox by creating a special extension.
 

KevinAr18,

You seem to be quite keen on the whole Firefox modification thing, I note (from several posts ;o).

Why not write an FAQ on the subject and post it in the FAQ section? I'm sure many people would find it quite useful.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top