My bandwidth speed tester, is there a better way?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to make a web page for my server that will test my download speed
to it.

What I've done is pretty basic but has a drawback.

1. I click a button
2. It records the start time
3. It loads an image
4. The image onload event triggers when it's all loaded
5. It gets the end time
6. It calculates the speed

The images are approx 1.5 MBytes.
It works, but if I try it a second time, the image is already loaded in
cache and so it doesn't work.
So then I thought (not hard enough obviously) of alternating between 2
So it works twice but then both images are in cache so I again have to
delete my temp Internet files.
I even tried to use META tags to prevent caching but I never understood how
these work and they don't work here!?
Is there a better way of doing this.

PS. Here is my code.

<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Cache-Control" Content="max-age=0">
<META Http-Equiv="Pragma"        Content="no-cache">
<META Http-Equiv="Expires"       Content="0">

<SCRIPT language=javascript>

var a;
var b;
var c;
var d;
var e;
var h;
var m;
var s;
var n;


function gettime()
  var t = new Date();
  h = t.getHours();
  m = t.getMinutes();
  s = t.getSeconds();
function begin()
  self.document.f1.i1.value=h + ":" + m + ":" + s;
function calc()
  self.document.f1.i2.value=h + ":" + m + ":" + s;
    self.document.f1.i5.value='You must delete your temporary Internet


<FORM name=f1>
<TABLE border=1><TR><TD align=center>
<FONT SIZE=4>Trial Speed-Test site</FONT><BR><BR>
<TABLE cellspacing=0 cellpadding=2 border=0>
<TR><TD>Start time </TD><TD><INPUT name='i1' value=''>
<TR><TD>End Time   </TD><TD><INPUT name='i2' value=''>
<TR><TD>Speed      </TD><TD><INPUT name='i3' value=''> kilobytes per second
<TR><TD>           </TD><TD><INPUT name='i4' value=''> Bytes per second
<IMG name='test' width=100 height=100 border=1 src='test.gif'
<INPUT name='i5' value='' size=50>
<IMG name='pic' width=0 height=0 border=0 src='' onload='self.calc();'>


Re: My bandwidth speed tester, is there a better way?

Guy said:

Quoted text here. Click to load it

use a bit of server side scripting to rename the image file every time
its used so no matter how many times the test is run the browser will
receive an image with a different name. easy peasy.

Quoted text here. Click to load it

<meta> cache directives are not effective, they're just so newbies can
feel like they're in control when they're not. (for some reason newbies
are always control freaks)

you configure the server to specify cache directives but once anything
has left your server you have no control over it. cache directives can
be and are ignored all the time.

04/December/2003 03:04:54 pm kilo

Re: My bandwidth speed tester, is there a better way?

: Is there a better way of doing this.

Re-inventing the wheel?  Try this:


Site Timeline