Solved

Loading gifs problem

Posted on 2002-07-30
13
123 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 50 total points
ID: 7187871
0
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now