loading order

J

Jean Pierre Daviau

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
 
R

RobG

Jean said:
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.
 
J

Jean Pierre Daviau

RobG said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

document.images[0].X 6
changing the barckground image 2
strange TR behavior 2
javascript corrupted? 8
circle tracing 10
running an ex on eMac 8
false popup not allowed? 5
document.images 8

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top