Javascript - Download/upload times w/bandwidth

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • - - Pierre

    Javascript - Download/upload times w/bandwidth

    Hi all,

    I'm trying to come up with a script and I'm having a heck of a time...

    I require users to enter the size (in MB or KB) of the attachment they
    wish to transfer/upload. As they enter the number and move over to
    the next field (using onBlur or...), I would like a popup/alert window
    warning them that this attachment size would take "x" amount of time
    based on a speed of 24 kilobits per second (kbps). If they are happy
    with the amount of time, I wish to allow them to click OK (to carry on
    with the transfer) or Cancel/No to cancel it.

    Anyone can assist me on this? I find this is quite difficult and
    would appreciate any assistance you could send my way.

    Cheers
    --P
  • Randell D.

    #2
    Re: Javascript - Download/upload times w/bandwidth


    "- - Pierre" <casdev@canada. com> wrote in message
    news:254e5e81.0 310031004.1cd1f 398@posting.goo gle.com...[color=blue]
    > Hi all,
    >
    > I'm trying to come up with a script and I'm having a heck of a time...
    >
    > I require users to enter the size (in MB or KB) of the attachment they
    > wish to transfer/upload. As they enter the number and move over to
    > the next field (using onBlur or...), I would like a popup/alert window
    > warning them that this attachment size would take "x" amount of time
    > based on a speed of 24 kilobits per second (kbps). If they are happy
    > with the amount of time, I wish to allow them to click OK (to carry on
    > with the transfer) or Cancel/No to cancel it.
    >
    > Anyone can assist me on this? I find this is quite difficult and
    > would appreciate any assistance you could send my way.
    >
    > Cheers
    > --P[/color]
    I don't have an answer for you - but I do know that pending the type of file
    you want to download/upload, the results can differ - For example, a 500kb
    txt file will transfer faster than a 500kb mp3, rm, jpg, gif or whatever
    else type file.

    This variation is not just due to filetype, but is in part related to the
    browser and web server - I was told this (here) when working on streaming
    media - I wanted to calculate the best streaming file to suggest to the
    client pending their internet connection - and I thought I could do this by
    timing a download of a small file.

    I was told that because some browsers (and web surfers) support a
    compression in tranzip similar to gzip that one might find on a unix/linux
    box. Web Clients have headers that tell the web server what it is capable
    of - If the web server is configured to compress it will do so automatically
    for every web client that can support compression and some files (like
    mp3/jpg/gif/streaming) have files that are already compressed and thus
    further compression won't make much of a difference - whereas an html or txt
    file will compress very well.

    So - you can only guess the transfer times - but even then, some guesses can
    vary tremendously - Also, when you think of it, if the web client is
    reasonably modern and receiving a compressed file - it uncompresses it
    automatically without user intervention and this requires client/computer
    resources - which in itself can effect the 'download' time (ie the "save as"
    dialog box will not have closed/completed until the full download has
    finished.

    So... I hope that gives you a rough idea - if you still want to give it a
    try I'm sure someone here will offer some solution that might help in some
    shape or form...

    randell d.


    Comment

    • - - Pierre

      #3
      Re: Javascript - Download/upload times w/bandwidth

      Thanks Randell. I appreciate the info. However, I simply need an
      approximation. You see, my users will be coming "thru" a satellite
      connection and I wish to give them an idea of the time it would take
      prior to clicking "save and close" and using this very expensive
      connection. Anyway, thanks again and hopefully someone has an idea.
      Anyone of you JS gurus???

      Ciao,

      --Pierre


      "Randell D." <you.can.email. me.at.randelld@ yahoo.com> wrote in message news:<0q3gb.292 16$pl3.26800@pd 7tw3no>...[color=blue]
      > "- - Pierre" <casdev@canada. com> wrote in message
      > news:254e5e81.0 310031004.1cd1f 398@posting.goo gle.com...[color=green]
      > > Hi all,
      > >
      > > I'm trying to come up with a script and I'm having a heck of a time...
      > >
      > > I require users to enter the size (in MB or KB) of the attachment they
      > > wish to transfer/upload. As they enter the number and move over to
      > > the next field (using onBlur or...), I would like a popup/alert window
      > > warning them that this attachment size would take "x" amount of time
      > > based on a speed of 24 kilobits per second (kbps). If they are happy
      > > with the amount of time, I wish to allow them to click OK (to carry on
      > > with the transfer) or Cancel/No to cancel it.
      > >
      > > Anyone can assist me on this? I find this is quite difficult and
      > > would appreciate any assistance you could send my way.
      > >
      > > Cheers
      > > --P[/color]
      > I don't have an answer for you - but I do know that pending the type of file
      > you want to download/upload, the results can differ - For example, a 500kb
      > txt file will transfer faster than a 500kb mp3, rm, jpg, gif or whatever
      > else type file.
      >
      > This variation is not just due to filetype, but is in part related to the
      > browser and web server - I was told this (here) when working on streaming
      > media - I wanted to calculate the best streaming file to suggest to the
      > client pending their internet connection - and I thought I could do this by
      > timing a download of a small file.
      >
      > I was told that because some browsers (and web surfers) support a
      > compression in tranzip similar to gzip that one might find on a unix/linux
      > box. Web Clients have headers that tell the web server what it is capable
      > of - If the web server is configured to compress it will do so automatically
      > for every web client that can support compression and some files (like
      > mp3/jpg/gif/streaming) have files that are already compressed and thus
      > further compression won't make much of a difference - whereas an html or txt
      > file will compress very well.
      >
      > So - you can only guess the transfer times - but even then, some guesses can
      > vary tremendously - Also, when you think of it, if the web client is
      > reasonably modern and receiving a compressed file - it uncompresses it
      > automatically without user intervention and this requires client/computer
      > resources - which in itself can effect the 'download' time (ie the "save as"
      > dialog box will not have closed/completed until the full download has
      > finished.
      >
      > So... I hope that gives you a rough idea - if you still want to give it a
      > try I'm sure someone here will offer some solution that might help in some
      > shape or form...
      >
      > randell d.[/color]

      Comment

      • sharkey

        #4
        Re: Javascript - Download/upload times w/bandwidth

        Sayeth Randell D. <you.can.email. me.at.randelld@ yahoo.com>:[color=blue]
        >
        > I don't have an answer for you - but I do know that pending the type of file
        > you want to download/upload, the results can differ - [...]
        > I was told that because some browsers (and web surfers) support a
        > compression in tranzip similar to gzip that one might find on a unix/linux
        > box. [...] and some files (like
        > mp3/jpg/gif/streaming) have files that are already compressed and thus
        > further compression won't make much of a difference - whereas an html or txt
        > file will compress very well.[/color]

        Also, if your user is using a 56K modem, for example, there's all
        sorts of data compression going on on the fly. And proxies to
        confuse the situation. And if you just happen to be taking your
        sample while they're downloading something else, or while someone
        else sharing a cable with them is, or whatever ...

        -----sharks

        Comment

        • Ivo

          #5
          Re: Javascript - Download/upload times w/bandwidth

          casdev@canada.c om (- - Pierre) wrote[color=blue]
          > warning them that this attachment size would take "x" amount of time
          > based on a speed of 24 kilobits per second (kbps). my users will be coming "thru" a satellite
          > connection and I wish to give them an idea of the time it would take
          > prior to clicking "save and close" and using this very expensive
          > connection.[/color]

          Not tested throughout, but this should provide some basic functionality:
          <input type=text onchange="ask(t his)">
          <script>
          function ask(el){
          size=el.value.t oLowerCase();
          sizeno=el.value .replace(/\D/g,'');
          if(size.indexOf ('kb')+1){sizen o=sizeno*1024;}
          if(size.indexOf ('mb')+1){sizen o=sizeno*1024*1 024;}
          seconds=Math.ro und(sizeno*8/24/1000);
          msg='At 24kbps, ' + size + ' would take '
          + minsec(seconds)
          + '.\nWould you like to continue?';
          if(confirm(msg) )
          {}//they accept
          else
          {el.value='';el .focus();}
          }
          function minsec(s){
          m=Math.floor(s/60);
          s-=60*m;
          if(m)m+=' minutes and ';
          return m+s+' seconds';
          }
          </script>
          HTH
          Ivo
          [color=blue]
          > Ciao,
          >
          > --Pierre
          >[/color]

          Comment

          Working...