Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928216
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:57:05+00:00 2026-05-17T06:57:05+00:00

Like many people I’ve been doing image preload for a long time, but not

  • 0

Like many people I’ve been doing image preload for a long time, but not always very rationally. So I’ve come up with this short list of thoughts about the right way to preload images with javascript.

  • An image preload script should be executed as soon as possible. It should be placed at the top of the HTML (in the HEAD section), unlike the others scripts that go to the bottom of the BODY section.
  • It must not rely on a library (such as jQuery) because that would delay the execution.
  • CSS sprites and background-images need not be preloaded because the CSS – normally called at the top of the HTML – already does the job (this of course reduces the overall need for javascript image preload).
  • The preload script can be placed and run on every page of the site so as to be sure it is effective no matter which page the user enters the site. (But what about the overhead of running the script every time, if only to check the images are now cached?)

I’d be very interested to hear your opinions on this subject.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:57:06+00:00Added an answer on May 17, 2026 at 6:57 am

    An image preload script should be executed as soon as possible. It should be placed at the top of the HTML (in the HEAD section), unlike the others scripts that go to the bottom of the BODY section.

    This puts greater precedence on images that might be shown if the user does something then on images which are part of the initial page. (Unless you are trying to preload images which are part of the initial page, which would be redundant).

    It must not rely on a library (such as jQuery) because that would delay the execution.

    Such a delay shouldn’t be significant

    CSS sprites and background-images need not be preloaded because the CSS – normally called at the top of the HTML – already does the job (this of course reduces the overall need for javascript image preload).

    Browsers may optimize and not load images mentioned in stylesheets if they aren’t being displayed.

    The preload script can be placed and run on every page of the site so as to be sure it is effective no matter which page the user enters the site. (But what about the overhead of running the script every time, if only to check the images are now cached?)

    Sensible cache control headers should avoid the need to make HTTP requests to check the freshness of images, so this should be negligible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So like many people, I'm excited about Ruby on Rails. Being a Windows user,
Like many SO people, I'm in front of a computer almost all day. I
Like many people here, I started my programming experience with the good ol' green
Like many people, I have several SVN repositories that contains several projects. I've decided
Like many people I'm interested on Objective - C and Cocoa programming. I know
Like many people, I have a splash screen that animates off to reveal the
I have read many people really like the MapMaker of Google Guava (Collections), however
I think many people have done some similar development tasks before: I would like
I'm pretty sure that many people have thought of this, but for some reason
There are many people that mark closing tags like this to help identify the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.