loading order

Discussion in 'Javascript' started by Jean Pierre Daviau, Feb 27, 2006.

  1. When I have something like this in a js file.
    listeImg = new Array();
    listeImg[1] = new Image(w,h);
    listeImg[1].src = "centre1.jpg";
    etc

    Are the images loaded after the page is loaded? In the same time? Before the
    page is loaded? The browser decision?
    If the visitors goes, before the procedure is over, to another page having
    a link to the same js file, will the other page allows for the rest of the
    images to be loaded?

    function caheImages(){
    listeImg[1].src = "centre1.jpg";
    etc.
    }
    If i put theese in a function called by an onLoad =caheImages() event. Will
    the loading pursue on the second page where the first page loading process
    left over?

    Thanks for your attention.


    Jean Pierre Daviau
    --
    Easyphp1.8
    Apache1.3.24
    DEVC++, borland 5.5
    windows Xp
    asus p4 s533/333/133
    Intel(R) Celeron (R) CPU 2.00 GHz
    http://www.jeanpierredaviau.com
    Jean Pierre Daviau, Feb 27, 2006
    #1
    1. Advertising

  2. Jean Pierre Daviau

    RobG Guest

    Jean Pierre Daviau wrote:
    > When I have something like this in a js file.
    > listeImg = new Array();
    > listeImg[1] = new Image(w,h);
    > listeImg[1].src = "centre1.jpg";
    > etc
    >
    > Are the images loaded after the page is loaded? In the same time? Before the
    > page is loaded? The browser decision?


    If the above statements are not inside a function, they will be executed
    when the browser gets to them. Loading of the images will start then
    and will proceed at a pace determined by the connection and browser
    settings.

    If they are inside a function that is called from an onload event, then
    loading will proceed from when the function is called.


    > If the visitors goes, before the procedure is over, to another page having
    > a link to the same js file, will the other page allows for the rest of the
    > images to be loaded?


    Once a new page starts loading, everything from the old page is dumped
    other than data that has been cached. Any script that was executing or
    data that was being downloaded from the first page will stop, including
    loading of the images.

    The second page will start to load the same images and may take
    advantage of data that has already been cached (or not, depending on
    settings and a variety of other factors). JavaScript has little or no
    control over any of that.


    > function caheImages(){
    > listeImg[1].src = "centre1.jpg";
    > etc.
    > }
    > If i put theese in a function called by an onLoad =caheImages() event. Will
    > the loading pursue on the second page where the first page loading process
    > left over?


    Only to the extent that the second page can take advantage of what has
    been cached previously. You, as a JavaScript programmer, can't direct
    the second page to pickup where the first page left off or to use cached
    images in preference to those on the server. There are other techniques
    to provide hints to the browser to cache stuff but you can't be certain
    that it will happen.


    --
    Rob
    RobG, Feb 27, 2006
    #2
    1. Advertising

  3. "RobG" <> a écrit dans le message de news:
    ABLMf.542$...
    > You, as a JavaScript programmer, can't direct the second page to pickup
    > where the first page left off or to use cached images in preference to
    > those on the server. There are other techniques to provide hints to the
    > browser to cache stuff but you can't be certain that it will happen.

    Would an onBeforeUnload event in the first page would be sufficient to throw
    that information with the url?lastloadedImage=3
    or
    a for loop testing for image complete in the second page

    Where can I get info on that. I have red the Fith editon of Dany Goodman
    book ... and did not find precise information on what you are .

    Thanks again
    Jean Pierre Daviau, Feb 28, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Seth Broomer

    Order of loading pages...

    Seth Broomer, Apr 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    456
    Seth Broomer
    May 3, 2004
  2. Soren Kuula
    Replies:
    2
    Views:
    495
    Soren Kuula
    Feb 1, 2004
  3. cspoh
    Replies:
    0
    Views:
    244
    cspoh
    Jul 31, 2003
  4. Stephan Kämper
    Replies:
    2
    Views:
    232
    Stephan Kämper
    Jan 18, 2004
  5. ofir
    Replies:
    0
    Views:
    182
Loading...

Share This Page