472,785 Members | 1,230 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,785 software developers and data experts.

measuring download speed

Hello, I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?

Thanks, - Dave
Jul 23 '05 #1
4 2942
D. Alvarado wrote:
Hello, I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?


You can't reliably detect the download speed as too many other things
can alter its results. Search the c.l.j archives on groups.google.com
for "determine download speed" and you can read the past discussions on it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
D. Alvarado wrote:
Hello, I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?


I do not have a link but this is not a hard one. All you need to know
is the size of the downloaded test data. Then you compute the number of
milliseconds passed between start and end of download and divide the
size by this value, getting the download speed in bytes/s, for example.
However, note that the real download speed may vary very much.

The test data could be the document itself where the client-side script
is included:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
...
<script type="text/javascript">
var start = new Date();
</script>
...
</head>

<body>
...
<script type="text/javascript">
var msPassed = new Date().getTime() - start.getTime();
var bytesPerMS = Math.round(byteSize / msPassed);
</script>
</body>
</html>

In IE, the value of byteSize can be obtained with
document.documentElement.outerHTML.length.

Or it could be a multimedia resource which size you know and which you
embed in a test document. With client-side J(ava)Script you could then
"start the timer" before it is loaded and "stop it" if it is loaded.
HTH

PointedEars
Jul 23 '05 #3
Thomas 'PointedEars' Lahn wrote:
D. Alvarado wrote:
Hello, I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?

I do not have a link but this is not a hard one. All you need to know
is the size of the downloaded test data. Then you compute the number of
milliseconds passed between start and end of download and divide the
size by this value, getting the download speed in bytes/s, for example.
However, note that the real download speed may vary very much.


And that "variation" is what makes your test useless. If I am
multi-tasking with a broadband connection, with 17 other applications
running, with low resources, and then reboot and try it again, then you
will get different results.

So, let me restate what has been said on many many occasions before now,
you can *not* _reliably_ determine the connection speed, you can only
try to *guess* the download speed at that particular time, and then its
still worthless.

Besides, coming from someone who preaches the "non-javascript" side of
scripting, your "solution" is definitely broken when script is disabled.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #4
JRS: In article <9f**************************@posting.google.com >, seen
in news:comp.lang.javascript, D. Alvarado <la***********@zipmail.com>
posted at Mon, 14 Jun 2004 14:05:54 :
Hello, I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?


<URL:http://www.merlyn.demon.co.uk/js-date1.htm> measures, if the
receiving computer is not distracted, the time taken to transfer the
majority of the page, and shows it at the end.

In the absence of cache effects, this gives a rough estimate of the
current download speed; not an entirely trustworthy one, but better than
nothing. It includes the time taken to render the page.

One might reasonably use it to decide whether to load a large graphic
unconditionally, or only on user request. If a 30 kB page was fetched
over a link in under a second, it is reasonable to believe that the link
is fast; if it took over a minute, that it is slow.

But the data must be treated with considerable caution.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mudge | last post by:
I'm writing PHP Web sites that are database driven with mysql. I'm looking for ways to measure the performance (speed) of my php code, so that I can find ways to write the fastest php code. Any...
2
by: duane | last post by:
Dear Experts: I am trying to measure a HTML page download time on the client side and store the value into a textfile located in the server. I have successfully measured the page download time...
12
by: chipgraphics | last post by:
:confused::confused: I have been on the quest to find a php script that can serve files for downloads and limit the speed at which the file is transfered to the user. I want a faster download...
20
by: upperclass | last post by:
Hi, I'm trying to find a decent way of measuring the running time of a long-running program. Say, the running time ranges from several seconds to more than a day. The standard clock()...
4
by: halimunan | last post by:
Hello all, I have a question, how do i measure the download/upload speed... as if download rate, upload rate or kbps transfer rate. i want to do my own windows application using C# to measure the...
11
by: blackx | last post by:
I'm using clock() to measure the speed of my code (testing the speed of passing by value vs passing by reference in function calls). The problem is, the speed returned by my code is always 0.0000000...
2
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Hi, I know there isn't a specific event property for the download speed, but can anyone tell me how to find it? I'm not sure how to write the code. Thanks, Jason
9
by: Ross | last post by:
I'm a newbie at this, and have searched a lot but can't find something that seems appropriate for measuring a recurring elapsed time. Creating an object with: var mydate = new Date(); seems...
4
by: nestle | last post by:
I have DSL with a download speed of 32MB/s and an upload speed of 8MB/s(according to my ISP), and I am using a router. My upload speed is always between 8MB/s and 9MB/s(which is above the max upload...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.