Uzytkownik "bart" <ba**@thatissecret.nlm> napisal w wiadomosci
news:40*********************@news.xs4all.nl...
i want to calculate a user download speed.
what would be the best way, let a java script calculate it?, or let php do
it?
i was thinking of using an image as testfile.
with php i could send the image data with a stream(add a no-cache header
with it)
Depends on how sophisticate you want the test to look. A pure server-side
solution is simpler to code, since you don't need to deal with browser
issues. On the other hand your visitor might end up staring at a blank
screen for a few seconds (or longer). McAfee has something like that:
http://promos.mcafee.com/speedometer/testing.asp
With client-side + server-side approach you can deliver a slicker interface,
but is harder to write. I fancy something like this: in an invisible iframe,
a PHP script would output a large number of white spaces. Every now and then
a <script>parent.ontransfer([# of bytes sent]);</script> gets toss in. The
Javascript function (back in the main page) updates the UI with statistics
and progress info. There'd be a cancel button for canceling the test.