I'm not sure I get the problem (correct me if I'm wrong!), but I'll give it a go.
It sounds like you're not putting the "stop timer" code in the callback for the request. In jQuery, I would do like this: var startTime = ( new Date() ).getTime(); $.get("url_to_exact_size_file.html", function(){ alert("Callback says the request took " + ( ( new Date() ).getTime() - startTime ) + " milliseconds" ); }); Hope that helps! /Anders On 23 Aug, 23:37, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > I think some people might have missed my problem as mixed in with the rest > of my post so I'm going to split it out. > > I'm having trouble with the bandwidth portion of my code. I'm loading an > image via AJAX, then checking to see how long it took when the callback > function runs. The problem is that the call is asynchronous and the rest of > the code is running before the load is done. > > How would I control that? I thought about putting the whole shebang inside > the callback function but I'm not sure if that's the best idea. Can anyone > advise me on the best way to proceed? Here's the link again: > > > <http://www.commadelimited.com/browsertest/>http://www.commadelimited.com/browsertest/ > > thanks in advance. > > _____ > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Andy Matthews > Sent: Thursday, August 23, 2007 2:40 PM > To: [jQuery] > Subject: [jQuery] User Environment Detection Suite. At 90% and need some > help with the rest of the way > > My company uses a user environment detection suite called Browserhawk > (http://www.browserhawk.com/) which sells for around $1k per server. It > detects a number of aspects about a web surfer's environment. The detailed > info on what it provides found can be found > here:http://www.browserhawk.com/showbrow.aspx. > > Currently we're using an older version of BH and we're deciding whether or > not it's worth it for us to upgrade as we really only "use" ONE of the > pieces that BH provides, the bandwidth test. We do store some of the other > data, but it's only used in helping us determine when to upgrade Flash, > screen res, and all that jazz. > > My manager came to me yesterday and asked me to see if there was a way for > us to collect that information without using BH. So I spent the last day > coming up with this: > <http://www.commadelimited.com/browsertest/>http://www.commadelimited.com/browsertest/. > It's a one for one match for > all of the pieces that we're storing and I think it's pretty accurate. > > So this post is serving four purposes. > > 1) I need help finishing this. > > I collected little snippets of code from various tutorial sites I found so > I'm sure it could be improved quite drastically. The BIG issue though is the > bandwidth test. The original code I found dynamically wrote an image to the > window, then ran a function via the image's onLoad method. That worked > really well, but I preferred to use an AJAX call. So the code "runs", but > it's not accurate, I think because my call is asynchronous and the code > needs the value right away. > > So how can I force my code to 'wait' for the results of the image load? > > 2) I'm offering this code to anyone who would like to use it [link to zip > file below]. The end result of all of this is that I'm going to do a post > and submit all of the collected data into our Stats database, as well as > store it in a user's session for use in various portions of our site. > > 3) I think something like this could be VERY valuable as a jQuery plugin, > but I have no idea where to begin with. > > 4) I'm trying to get a good mix of browsers and OS to make sure that things > are working as well as possible. If you wouldn't mind running this page: > > <http://www.commadelimited.com/browsertest/>http://www.commadelimited.com/browsertest/ > > , then copying and pasting their results to me OFF LIST, I'd appreciate it. > > Here's a zip file if anyone would like to look at it locally: > > <http://www.commadelimited.com/browsertest/>http://www.commadelimited.com/browsertest/userInfoDetection.zip > > The server side stuff is written in ColdFusion, but it's only basic code. > Could be easily altered for PHP, ASP, or Ruby I suppose. > > ____________________________________ > > Andy Matthews > Senior ColdFusion Developer > > Office: 877.707.5467 x747 > Direct: 615.627.9747 > Fax: 615.467.6249 > [EMAIL PROTECTED]<http://www.dealerskins.com/> > > attb8779.bmp > 6KHämta