SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    967
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Band Width Switcher

    How would you go about writing a script to switch the style sheet if low bandwidth is detected? Is this even possible?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by eruna View Post
    How would you go about writing a script to switch the style sheet if low bandwidth is detected? Is this even possible?
    The only way to detect bandwidth is to time the transfer of a file.

    What you could do is to show a link to the low-bandwidth version while the large bandwidth version is loading,.

    The low-bandwidth version could then store that preference in a cookie, so that other pages can then find out.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This will have to be javascript assisted by php. You can get php to print a timestamp when the page is requested. Javascript can detect when the page rendering is complete. The difference between the times should give you a rough idea of the bandwidth. A single image should be enough to detect this because javascript can detect when the image loading is complete.

  4. #4
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    967
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks this is very helpful. Google analytics shows bandwidth of users so I knew there must be a way.


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
  •