hi am using this snippet for preload image using javascript
window.onload=function(){
heavyImage.src = "images/qq-lookupbody-holder.png"; (ON PAGE LOAD)
}
But am not find any different after i added this js snippet,
Is there any way to check , the preloader script is really worht or not….
If you’re doing it in a page “load” handler, it won’t help because “load” isn’t called until the images are ready. Call it before that, however, and it could make a difference, maybe, though one way or the other the browser has to fetch the image. Things like that can help when you preload images for other pages on your site. That gets them into the browser cache, so that when the user reaches a page that actually uses the image, it’s cached.
Also, you didn’t post it, but I assume that the line of code you supplied actually follows a line where “heavyImage” is set to an actual “Image” instance:
edit — well after your update I can tell you that under no circumstances will that code help to load your image. Again, you can try this:
Don’t put that in an “onload” handler however. Just put it in a
<script>block in the<head>of the document. Still, it may or may not really help. If you can arrange to preload the image on a page before your site visitor reaches the page with the image, then that could make a big difference.