Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Loading gifs problem

Posted on 2002-07-30
13
Medium Priority
?
131 Views
Last Modified: 2010-04-09
Hi,

I have a page wherein I am building a MenuTree (like windows explorer). Each node(eg + symbol) has a small icon sort of gif attached to it.

In order to avoid the loading timing of the tree to be less, I have written a function wherin I preload the gif images in javascript image objects.

Also Since there are only 15 gif files, what i think is whenever same gif file is being referenced the browser should not start downloading the gif files if they have already been referenced in the tree. But i can see in the status bar it tries to download gif files again and again.

This is giving me a performance problem during onload of the tree.

I have used a Img src property for the gif.

Can anyone help ?

Pankaj
0
Comment
Question by:Pankaj27
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 14

Expert Comment

by:avner
ID: 7187824
Are you using webfx xtree?
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7187861
No, its a normal tree prepared from html objects
0
 
LVL 14

Accepted Solution

by:
avner earned 200 total points
ID: 7187871
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Pankaj27
ID: 7187902
No it is not a webfx tree. But i had a look at the URL u have send me avner. Its almost similar code. But if there is a lot of data it takes about 1 minute to load the tree and all that time browser is trying to download the images.
0
 
LVL 14

Expert Comment

by:avner
ID: 7187905
how have you implemenetd the images in the tree nodes ?
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7187908
as an image tags. i.e <img scr=
0
 
LVL 14

Expert Comment

by:avner
ID: 7187927
I made a small test , as I saw first time you load the page it always load one by one, while in the next time it gets the images from cache and not one by one :

function createImagesExample()
{
     var oImg=document.createElement("IMG");
     oImg.src = "http://www.experts-exchange.com/images/kp_logo2.gif";

     var max =100;
     var doc = document;
     var oBody = doc.body;

     for (var i=0; i< max ; i++)
               {
               /*var oImg2 = doc.createElement("IMG");
               oImg2.src =  oImg.src*/
               oBody.appendChild(oImg.cloneNode());
               }


}
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7188016
Thanks avner,

I ran ur code on my machine..first time it gave me downloading images 100 times. Next time it didnt. This is since the entry for the image went in the cache. But on the machine.. i am trying to run, the image is not going in the cache, so its downloading again.

Pankaj
0
 
LVL 14

Expert Comment

by:avner
ID: 7189672
I am not sure I understand your last sentece, what is the situation in your case in the second case ? are you using same method as I did to load the images ?

In my example there are two different methods, one of them is commented, it behaves exactly as the firts one, you might want to try that approach.
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7189948
In fact its that approach which i am using in my code. That is doing an <img src> . I have also tried doing a clone node but did not improve the performance. I will paste the code soon as soon as I am out of the meeting.

Thanks Avner,
Regards
Pankaj
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7271019
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7403209
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to avner

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7431201
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question