OK, I've given away a lot of advice and scripts around here. Can anybody return the favor?! :)
I need a script that detects the user's download speed. I've seen of couple of examples on the web, but I'm stumped on a particular part.
The hard part: The data that loads in the middle is compressed binary, between comment tags. How do I get the compressed binary into my page? I've tried copying what I've seen, but it either prints out to the page (even though it's in comment tags), or it freaks out my editor to the point where I can't even work with the page anymore.
Confused? If not and you have any insight into this, please share! Thanks.
Sounds interesting. Can you post the links to the pages you found examples on. I would like to mess with it a bit myself. :)
I've seen something similar on C|Net Downloads, where it shows the speed of the modem. I'm not sure if that is what you are talking about, though.
This might be JUST what you are looking for...
One of the examples I was looking at was at http://www.jefftech.net/library310.html
View the source and you'll see the binary code.
There's a glitch in that one however, since you can't reload the page and get a result. I've solved this in my example by always appending a random number to the end of the URL of my script, and a random number on the end of the gif that I load, to prevent caching.
The other was on CNet, but I don't have the link to that one at the moment.
Thanks for the link, I'll check that one out and see what kind of results it gives.
In the meantime, I just used a gif, and timed it's download to get a rough idea of the user's speed. It isn't completely accurate, but it gives a good ballpark estimate, since I'm only wanting to determine if the user has a 56K modem, or a DSL or faster connection. Most of the examples I saw on the web used compressed binary code to time the download, and they indicated it would be more accurate since their was little chance of the data being further compressed in transit.
I'll post a link to my version after I tweak it a bit more.
Right on...I would be interested in seeing that page. Sounds cool.
Thanks for the link scrubz. I don't have time to look into it much at the moment, but one comment I have (and I know this is being a bit picky and you didn't ask for it :rolleyes: ) is that with a random number you could potentially hit the same one twice. Probably not too important for this application, but for future reference another option that gets rid of this potential problem is to use a time stamp instead of the random number.
I'm headed in a million different directions this week, so this little task is on hold for now. Thanks for the info JWatt - good point about the random number. Although there's a small chance of a duplicate random number (between 1-100000), I see your point. The timestamp is a good workaround for this.
To be continued!...