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 263991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:38:53+00:00 2026-05-11T22:38:53+00:00

My site loads images based on names that are created for them. It loads

  • 0

My site loads images based on names that are created for them. It loads images assuming that they’re there when sometimes they’re not. Every time it loads an image like this:

<img src="/myimages/my-image.jpg" alt=""/>

if it’s not there on the server, it seems to cache that there wasn’t an image there, so next time I load up the same image after my-image.jpg has been saved to the server, it just shows up as blank… How can I make it so that it’s not caching images that it doesn’t find?

Edit: I still want to cache images that it finds

OR

Alternatively, how do you check that a file exists? (preferably from javascript). That way I could check if the image exists before loading it and I would completely subvert this problem.

Thanks,
Matt

  • 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-11T22:38:54+00:00Added an answer on May 11, 2026 at 10:38 pm

    If you are able to, check from the server before the HTML file is ever sent to the client.

    If this isn’t an option, you can use ajax:

    1. call a page, passing in a request parameter of the file name
    2. In the page, check this file name and based on that pass back either true or false.
    3. Back in the javascript, if it’s true (file exists), allow that image to load. Otherwise, load a default (placeholder) image, or just don’t show any image at all.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a site that dynamically loads content, replacing images based on the results
I have a site that uses a large centered background image, which naturally loads
I'm trying to build a site that loads another site within it, but with
I'm trying to have a site set up so when the page loads there
I've got a site that loads all 'pages' and 'content' using 100% AJAX. I'm
I have a JS photo gallery that loads individual images from an API into
I've got a function that resizes images based on some criteria and would like
I have a beautifully slick and elegant website that loads in double quick time,
I have a site on example.com that loads all its static components from s.example.com
I'm trying to load charts as images in a secured site. An example of

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.