How to get the percentage amout of a file being loaded ?

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

    How to get the percentage amout of a file being loaded ?

    Hi All,

    i'm trying to display the amout in percentage for the loading sub event
    value,
    for the <img .../>


    example:

    the browser should display something like this:

    view 1, time 00:00:05
    loading 5%
    =============== =====
    view 2, time 00:00:010
    loading 10%
    =============== =====
    view 3, time 00:00:57
    loading 99%
    =============== =====
    view 4, time 00:01:00
    complete 100%
    <!-- the image is showen -->

    =============== =====
    i have this code:

    <script language="vbscr ipt">
    Function showState_onrea dy()
    IF myImgID.readySt ate = "loading" then
    myDivID.innerTe xt = myImgID.readySt ate & " " & strPerventage
    Else
    myDivID.innerTe xt = myImgID.readySt ate & " " & "100%"
    End If
    End Function
    </script>

    <html>
    <head></head>
    <body>
    <div id="myDivID"></div>
    <img id="myImgID" src="img.jpg"
    onreadystatecha nge="vbscript:s howState_onread y('')" />
    </body>
    </html>

    i'm trying to display the image amount of the file loaded in
    percentage,
    how do i do it?

  • Anthony Jones

    #2
    Re: How to get the percentage amout of a file being loaded ?


    "thisis" <helloOne@web.d ewrote in message
    news:1162547693 .329206.298720@ e3g2000cwe.goog legroups.com...
    Hi All,
    >
    i'm trying to display the amout in percentage for the loading sub event
    value,
    for the <img .../>
    >
    >
    example:
    >
    the browser should display something like this:
    >
    view 1, time 00:00:05
    loading 5%
    =============== =====
    view 2, time 00:00:010
    loading 10%
    =============== =====
    view 3, time 00:00:57
    loading 99%
    =============== =====
    view 4, time 00:01:00
    complete 100%
    <!-- the image is showen -->
    >
    =============== =====
    i have this code:
    >
    <script language="vbscr ipt">
    Function showState_onrea dy()
    IF myImgID.readySt ate = "loading" then
    myDivID.innerTe xt = myImgID.readySt ate & " " & strPerventage
    Else
    myDivID.innerTe xt = myImgID.readySt ate & " " & "100%"
    End If
    End Function
    </script>
    >
    <html>
    <head></head>
    <body>
    <div id="myDivID"></div>
    <img id="myImgID" src="img.jpg"
    onreadystatecha nge="vbscript:s howState_onread y('')" />
    </body>
    </html>
    >
    i'm trying to display the image amount of the file loaded in
    percentage,
    how do i do it?
    >
    IE doesn't expose info on the current progress of an image download. All
    you get is a few changes in state when the download starts to received data
    and when the data had complete arrived. You get nothing in between.

    The best you can do is guestimate the time involved in the download and use
    a window.interval to call an update progress function. In this function
    test the readyState of the image if still loading update your progress info
    based on time elapsed otherwise set progress to 100% and kill the interval
    handle.


    Comment

    • thisis

      #3
      Re: How to get the percentage amout of a file being loaded ?


      Anthony Jones wrote:
      "thisis" <helloOne@web.d ewrote in message
      news:1162547693 .329206.298720@ e3g2000cwe.goog legroups.com...
      Hi All,

      i'm trying to display the amout in percentage for the loading sub event
      value,
      for the <img .../>


      example:

      the browser should display something like this:

      view 1, time 00:00:05
      loading 5%
      =============== =====
      view 2, time 00:00:010
      loading 10%
      =============== =====
      view 3, time 00:00:57
      loading 99%
      =============== =====
      view 4, time 00:01:00
      complete 100%
      <!-- the image is showen -->

      =============== =====
      i have this code:

      <script language="vbscr ipt">
      Function showState_onrea dy()
      IF myImgID.readySt ate = "loading" then
      myDivID.innerTe xt = myImgID.readySt ate & " " & strPerventage
      Else
      myDivID.innerTe xt = myImgID.readySt ate & " " & "100%"
      End If
      End Function
      </script>

      <html>
      <head></head>
      <body>
      <div id="myDivID"></div>
      <img id="myImgID" src="img.jpg"
      onreadystatecha nge="vbscript:s howState_onread y('')" />
      </body>
      </html>

      i'm trying to display the image amount of the file loaded in
      percentage,
      how do i do it?
      >
      IE doesn't expose info on the current progress of an image download. All
      you get is a few changes in state when the download starts to received data
      and when the data had complete arrived. You get nothing in between.
      >
      The best you can do is guestimate the time involved in the download and use
      a window.interval to call an update progress function. In this function
      test the readyState of the image if still loading update your progress info
      based on time elapsed otherwise set progress to 100% and kill the interval
      handle.
      Hi Anthony Jones,

      i think your "IE doesn't expose info on the current progress of an
      image download."
      is in correct.

      look at this link, see the status bar on the IE, which displays:
      10 items left
      9 items left
      ....
      (the displaying happens real fast)


      and i have another example, on my intranet, a page that i worte. i
      didn't write anything special for the behaviour of the status bar i
      desrcibed.

      about your suggestion, i'm trying to think about over.

      Comment

      • Anthony Jones

        #4
        Re: How to get the percentage amout of a file being loaded ?

        >

        IE doesn't expose info on the current progress of an image download.
        All
        you get is a few changes in state when the download starts to received
        data
        and when the data had complete arrived. You get nothing in between.

        The best you can do is guestimate the time involved in the download and
        use
        a window.interval to call an update progress function. In this function
        test the readyState of the image if still loading update your progress
        info
        based on time elapsed otherwise set progress to 100% and kill the
        interval
        handle.
        >
        Hi Anthony Jones,
        >
        i think your "IE doesn't expose info on the current progress of an
        image download."
        is in correct.
        >
        look at this link, see the status bar on the IE, which displays:
        10 items left
        9 items left
        ...
        (the displaying happens real fast)
        http://images.google.co.il/images?hl...=Search+Images
        This is updating the as each individual image is complete. You could get
        access to this by attaching an event handler to each img in your page. But
        your post indicates that you are downloading a single large image.
        >
        and i have another example, on my intranet, a page that i worte. i
        didn't write anything special for the behaviour of the status bar i
        desrcibed.
        You're refering to the IEs own internal updating to the status bar. IE has
        access to the internal workings of the Wininet stack and can therefore can
        do things like that as well as show a download progress bar (not that it's
        all that reliable anyway). However that does not mean that IE provides any
        API by which a page developer can get access to these events. It doesn't.
        >
        about your suggestion, i'm trying to think about over.
        >
        How about letting IE's solution BE the solution?



        Comment

        • thisis

          #5
          Re: How to get the percentage amout of a file being loaded ?


          Anthony Jones wrote:
          "thisis" <helloOne@web.d ewrote in message
          news:1162547693 .329206.298720@ e3g2000cwe.goog legroups.com...
          Hi All,

          i'm trying to display the amout in percentage for the loading sub event
          value,
          for the <img .../>


          example:

          the browser should display something like this:

          view 1, time 00:00:05
          loading 5%
          =============== =====
          view 2, time 00:00:010
          loading 10%
          =============== =====
          view 3, time 00:00:57
          loading 99%
          =============== =====
          view 4, time 00:01:00
          complete 100%
          <!-- the image is showen -->

          =============== =====
          i have this code:

          <script language="vbscr ipt">
          Function showState_onrea dy()
          IF myImgID.readySt ate = "loading" then
          myDivID.innerTe xt = myImgID.readySt ate & " " & strPerventage
          Else
          myDivID.innerTe xt = myImgID.readySt ate & " " & "100%"
          End If
          End Function
          </script>

          <html>
          <head></head>
          <body>
          <div id="myDivID"></div>
          <img id="myImgID" src="img.jpg"
          onreadystatecha nge="vbscript:s howState_onread y('')" />
          </body>
          </html>

          i'm trying to display the image amount of the file loaded in
          percentage,
          how do i do it?
          >
          IE doesn't expose info on the current progress of an image download. All
          you get is a few changes in state when the download starts to received data
          and when the data had complete arrived. You get nothing in between.
          >
          The best you can do is guestimate the time involved in the download and use
          a window.interval to call an update progress function. In this function
          test the readyState of the image if still loading update your progress info
          based on time elapsed otherwise set progress to 100% and kill the interval
          handle.
          Hi Anthony Jones,


          i'm not clear with this:
          The best you can do is guestimate the time involved in the download and use
          a window.interval to call an update progress function. In this function
          test the readyState of the image if still loading update your progress info
          based on time elapsed otherwise set progress to 100% and kill the interval
          handle.
          do you have an example for this: guestimate the time involved, usage of
          window.interval ?

          Comment

          Working...