PDA

View Full Version : Detect modem speed (or connection type, anyway)?


gorilla1
08-09-2002, 10:39 PM
I am working on a site where I want to have a slideshow consisting of a bunch of images that can be as big as 50kb. In order to make this work for dialup useers, I thought I better not preload the images (since that would mean a long initial wait for the dialup user) - instead I will load each image while the prior one is showing. However, at 50 kbs, which is about the best speed a 56 kbs modem gets, 10 seconds or so is needed to safely load a 50 kilobyte iamge. If the viewer is coming via high bandwidth, I don't think I want to make them wait 10 seconds. So I wonder is there a way to detect a dialup connection, so that I could then dynamically adjust my wait time accordingly? And then, secondly, I guess I better wait until the page is completely loaded before starting the timer, etc - can I do this?

G

brothercake
08-09-2002, 11:02 PM
check this out - http://www.brothercake.com/scripts/modemspeed.shtml - it's not totally accurate, for reasons explained on the page you'll end up with a figure that's a bit slower than the true connection speed, but it should give you a good enough idea to discriminate between dialup and broadband. You could set its output value in a session cookie.

Vladdy
08-09-2002, 11:06 PM
The way I am approaching the same problem is:
- start slide show by processing body onLoad event.
- have some introductory text to display while the first image loads.
- have a loadImage function that is called using previous image onLoad event (call it from the slide show initialization routine for the forst image)
- have a showNext function that does the following:
see if the next image is available
if not call itself in say half a second
if it is display it and call itself in say 5 seconds or whatever your slide show delay is.

That approach allows to separate image loading from showing. For the fast connection images are shown using the default delay, for the slower connection they are shown as soon as available. You do not have to recalculate delay for different image sizes.

Hope that helps.

gorilla1
08-09-2002, 11:28 PM
Ah, thanks very much Vladdy and Borthercake for the very good ideas. ... Vladdy, I am using a script that checks to see if the image has downloaded and then waits 100 ms and tries again if it is not. But still I find on diaulp of 50 kbs that my slideshow gets stuck after an image or two when set at 8 seconds. (The complexity may be compounded a bit by the fact that I am doing a fade between images.) Good point, though - that ought to take care of it - don't know why it isn't... But I will work with some of these ideas.

G

Quiet Storm
08-10-2002, 12:33 AM
http://www.angelfire.com/mo2/cbch21/LEX.html

gorilla1
08-10-2002, 01:27 AM
QS,

Client capabilities. Wow, that is pretty amazing. However, only in iE and IE5+ specifically, looks like.

G

jkd
08-10-2002, 04:07 AM
Brothercake, it says my Mozilla browser just built on the 6th off of the 1.1 trunk w/ brand spanking new SVG backend "isn't compatible" - but after going to the page anyway, it works fine.

Might be something you want to look into.