Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
How to preload images and contents for a website?

 
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum
Author Message
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: How to preload images and contents for a website? Reply with quote

Is there an easy way to preload contents to users' cache? Not only images. I want to preload all kind of contents for the web page. Preload Texts too if possible.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Fri Jul 30, 04 5:31 am
Back to top
emm View user's profile Send private message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Preload any web content Reply with quote

I know of many many preloaders but they all almost exclusively preload only images. Preloading all contents? Umm...now that's a bit tricky! How about this? You use a very tiny ( maybe 2 px y 2 px dimension) iframe and load all the contents that you want to preload in that iframe. It won't be visible but the contents will be preloaded alright in the user's computer cache! Then you can show the contents or text or whatever in the subsequent pages very quickly. Hmm...this might work for you.

For anyone interested in normal image preloaders or how preloaders in general work, refer to this site:

[http://www.webreference.com/programming/javascript/gr/column3/]

This site generates customized javascript codes for your images to preload.

[http://www.webpage-tools.com/imgpreload.asp]
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Sat Jul 31, 04 9:18 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Preload web content Reply with quote

I see what you are heading to. Yes, that might work. I will take it to a test drive and see what happens.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Sat Jul 31, 04 10:22 pm
Back to top
emm View user's profile Send private message
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Easyest and simplest javascript image preloader Reply with quote

I think, the javascript below is the easiet to apply image preload for any browser. Simple and effective.

Code:
<script language="JavaScript1.2" type="text/javascript">
<!--Hide from older browsers
//begin preload script
     var count = 0;

     function preLoad() {
     one = new Image();
     one.onload = loadCheck;
     one.src = "image1.jpg";


     two = new Image();
     two.onload = loadCheck;
     two.src = "image2.jpg";

     three = new Image();
     three.onload = loadCheck;
     three.src = "image3.jpg";
   
     four = new Image();
     four.onload = loadCheck;
     four.src = "image4.jpg";
   
     five = new Image();
     five.onload = loadCheck;
     five.src = "image5.jpg";
   
     six = new Image();
     six.onload = loadCheck;
     six.src = "image6.jpg";
   
     seven = new Image();
     seven.onload = loadCheck;
     seven.src = "image7.jpg";
 
     eight = new Image();
     eight.onload = loadCheck;
     eight.src = "image8.jpg";

     }
     function loadCheck() {
     count++;
     if(count == 8){
     preLoad();
     }
     }
//end hiding from older browsers -->
</script>
</head>
<body onload="preLoad()">


You have to rename the image file names here. Also the line below should have the correct number for the total number of images to preload.

if(count == 8){
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Thu Aug 26, 04 4:09 am
Back to top
emm View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group