Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / February 2006



Tip: Looking for answers? Try searching our database.

loading order

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jean Pierre Daviau - 27 Feb 2006 22:04 GMT
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
RobG - 27 Feb 2006 23:06 GMT
> When I have something like this in a js file.
> listeImg = new Array();
[quoted text clipped - 4 lines]
> 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";
[quoted text clipped - 3 lines]
> 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.

Signature

Rob

Jean Pierre Daviau - 28 Feb 2006 18:13 GMT
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.