[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Making images download only once

Posted on 2001-07-29
7
Medium Priority
?
187 Views
Last Modified: 2010-04-09
I have a list that I'm building dynamically that contains about 200 entries. Beside each item, I place 3 hyperlinked images. It looks to me like web browsers are downloading these 3 images once for each record, not once for each page. This makes the download time on a modem around 1 minute.

The html for the page is about 5K, the images are around 2k combines, the reported page size when it downloads is about 200 kb.

- The images are included using the usual <img src> tags.
- The list is build in a Perl script that is included using SSI
- The webserver is Apache for linux

Anyone know how I can get the browser to download these images only once?

Thanks!
0
Comment
Question by:GeoffHart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:egbservices
ID: 6332961
What about pre-loading the images...

Pre-load an image...
<script>
image1 = new Image();
image1.src = "some.gif";
</script>
This will load them into the cache... ready for display.
0
 
LVL 2

Expert Comment

by:egbservices
ID: 6332966
What about pre-loading the images...

Pre-load an image...
<script>
image1 = new Image();
image1.src = "some.gif";
</script>
This will load them into the cache... ready for display.
0
 
LVL 2

Expert Comment

by:egbservices
ID: 6332972
Or this way if pre-loading does the job...
<script language="JavaScript"><!--
     if (document.images) {
     var img1 = new Image();
     img1.src = 'http://www.domain.com/path/image1.gif';
     var img2 = new Image();
     img2.src = 'http://www.domain.com/path/image2.gif';
     // ... etc for all your other images
     }
// --></script>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

by:
coreyti earned 400 total points
ID: 6333041
If the three images are the same for each entry (you are reusing the same 3 images 200 times over AND the uri path is the same each time), then that shouldn't be your problem.

Taking a stab in the dark, I'd guess that the script is the trouble. The external html maybe only 5k, but having a dynamic section included into it means that the script has to run and the results effectively pasted into the html before it is shipped of to the client.

Some sample code might help us track it down more.

-corey
0
 
LVL 1

Expert Comment

by:yitz99
ID: 6333228
Agreeing with Corey...

test your script by printing the time in HTML comments at the beginning and end.  

Why not post your URL?
0
 
LVL 2

Expert Comment

by:englishman
ID: 6337828
Or, copy the source after it has downloaded, paste it into a new html page and view it to see how long it takes without script processing.
0
 
LVL 1

Author Comment

by:GeoffHart
ID: 6342718
I couldn't post the actual script, since it is build using data from a confidential database. When I was producing the test script which I was going to link to demonstrate the problem, I noticed the error.

It turns out, the HTML page was only 5 kb and the 3 images were downloaded once. What happened is that the script also produces a javascript which consists of around ten lines. This got included one level of brackets too deep, and got spooled out 200 times onto the page (140kb of code!).

I also checked the script generation time, it was < 1 second.

Thanks everyone for your help.
0

Featured Post

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.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

649 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