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

  • Home
  • SEARCH
  • 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 7836263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:03:39+00:00 2026-06-02T14:03:39+00:00

This question is not about IE caching XHR calls, I’ve tackled the caching and

  • 0

This question is not about IE caching XHR calls, I’ve tackled the caching and I get proper results (i.e. changed) from my XHR calls. However: in my XHR response, which is HTML, not only the HTML is changed, but also the image to which the HTML refers is changed. While the HTML changes properly, this image does not change, only when I completely refresh the page.

So, the XHR call itself is not cached, but the linked resources do appear to be cached. This means any solution that focuses on the XHR call does not work (like adding an extra parameter to the URL or setting headers). It seems like the browser (I’ve tried Safari and Firefox) decide to use their cache to help the XHR call with its linked resources. Indeed, the dev tools show only the transfer of the XHR, and no additional files.

How can I force the browser into properly loading (requesting) the images that come in the XHR call?

I’m using PHP server-side (also serving headers), and MooTools for handling the XHR calls. Scripts are never cached, images check for ‘if-modified’ headers (although I’ve tried never caching these as well).

  • 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-02T14:03:40+00:00Added an answer on June 2, 2026 at 2:03 pm

    You could run this JavaScript code on the response…

    var container = document.createElement('div'),
        date = +new Date;
    
    container.innerHTML = htmlReturnedFromXHR;
    
    [].forEach.call(container.querySelectorAll('img[src]'), function(img) {
        img.src += '?' + date;
    });
    

    Alternatively if you had to support older browsers replace the loop from above with…

    var img = container.getElementsByTagName('img');
    
    for (i = 0, length = img.length; i < length; i++) {
        img[i].src += '?' + date;
    }
    

    MooTools code to perform above action:

    var container = document.createElement('div'),
        date = +new Date
        imgs = container.getElements('img');
    
    imgs.each(function(img) {
        img.src = img.src + '?' + date;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question calls for "line numbers". If you do not care about line numbers
This question is not about which is the best, it is about which makes
This question is not about 'best' barcode library recommendation, we use various products on
(note that this question is not about CAS, it's about the May fail spuriously
For starters, this question is not so much about programming in the NetBeans IDE
Not much to say about this question...
This is not a question about a specific framework. I am using plain php
This is not a question about jQuery, but about how jQuery implements such a
Disclaimer: this is not a question about how to install asp.net or an application
Please note this is not a question about online/hosted SVN services. I am working

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.