Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > loading order

Reply
Thread Tools

loading order

 
 
Jean Pierre Daviau
Guest
Posts: n/a
 
      02-27-2006
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


 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      02-27-2006
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
 
Reply With Quote
 
 
 
 
Jean Pierre Daviau
Guest
Posts: n/a
 
      02-28-2006

"RobG" <(E-Mail Removed)> a écrit dans le message de news:
ABLMf.542$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
order of iframe loading with document loading ofir Javascript 0 12-03-2007 12:06 PM
If you get an order # does it mean the order is accepted? =?Utf-8?B?U3RldmUxMDc3?= Windows 64bit 3 05-12-2005 11:46 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
In which order are files looked for when loaded/requierd - and what'sthe order of suffixes? Stephan Kämper Ruby 2 01-18-2004 02:07 PM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments