SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Basically, the page that detects the speed uses JavaScript to start a timer, then there is some data to load in the middle, and another JavaScript to stop the timer. Then a few calculations are done on the start and end time, taking into consideration the size of the data, and you end up with a rough idea of the kilobytes per second the user is capable of.

    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.

  2. #2
    SitePoint Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds interesting. Can you post the links to the pages you found examples on. I would like to mess with it a bit myself.
    jonathan

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Love it? Hate it? Helpful? Useless?
    Use the rate button to let me know what you think of my post!

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Scrubz...

    This might be JUST what you are looking for...

    http://www.hotscripts.com/Detailed/4087.html
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    JWatt:

    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.

    Creole:

    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.

    Thanks all.

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right on...I would be interested in seeing that page. Sounds cool.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    SitePoint Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 ) 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.
    jonathan

  8. #8
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!...



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •