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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:23:09+00:00 2026-06-08T05:23:09+00:00

I want to display two images that I have no idea when they will

  • 0

I want to display two images that I have no idea when they will be generated. So I want to use the jquery error function to keep checking if the images exist, and display each. Following code works on every browser except IE. Why does it not work on IE, really appreciate your help.

<style type="text/css">
DIV#loader {
    width: 500px;
    height: 500px;
    overflow: hidden;
}

DIV#loader.loading {
    background: url(spinner.gif) no-repeat center center;
}
</style>


<script type="text/javascript">
$(document).ready(function() {
    var image_names = new Array(2);
    image_names[0] = 'a.jpg';
    image_names[1] = 'b.jpg';
    var divs = document.getElementsByTagName("div");
    for ( var i = 0; i < divs.length; i++) {
        showImage(image_names[i], divs[i]);
    }
});

function showImage(src, div) {
    var img = new Image();
    $(img).load(function() {
        $(this).hide();
        $(div).removeClass('loading').append(this);
        $(this).fadeIn();
    }).error(function() {
        setTimeout(function() {
            $(img).attr('src', src);
        }, 2000);
    }).attr('src', src);
}
</script>

This is the HTML body

<body>
<h1>Image Loading</h1>
<div id="loader" class="loading"></div>
<div id="loader" class="loading"></div>
</body>

It seems like IE does not know the image is generated if it does not exist when the page first loads

  • 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-06-08T05:23:10+00:00Added an answer on June 8, 2026 at 5:23 am

    Caching caused the problem. Changed the src to:

    $(img).attr('src', src + "?" + (new Date().getTime()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got two images one that i want to display on the top
I have two tables and I want to display only the child ID that
I have two images. I want to display one image if its day and
I have three images that I want to display in a single row next
I would like to display an image composed of two images. I want image
I have two possible widths for a string i want to display in a
If i have two tables Books, CDs with corresponding models. I want to display
What I want is a function I can run on user input that will
I want to have a class Utils, that will have several methods used all
Basically I have a WPF application that will display announcements to the user within

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.