By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,408 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,408 IT Pros & Developers. It's quick & easy.

loading order

P: n/a
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
Feb 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Feb 27 '06 #2

P: n/a

"RobG" <rg***@iinet.net.au> a écrit dans le message de news:
AB*****************@news.optus.net.au...
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
Feb 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.