Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML Need to reload images ignoring cache in HTML

bLANCHARDTECH

New Coder
This is the code I have. I can only use javascript and html to accomplish this. Any Ideas?


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <title></title>
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    <meta http-equiv="pragma" content="no-cache" />
    <script>
        setTimeout(function () {
            window.location.reload(1);
        }, 60000);
    </script>
</head>
<html>
<body style="background-color: #FFFFFF">
    <p>
    <img alt="Outside Temp" height="220" width="128"  id="reloader1" src="https://cws.a2hosted.com/weather/OutsideTemp.gif#" + new Date().getTime();/>
    <img alt="Inside Temp" height="220" width="128"  id="reloader2"  src="https://cws.a2hosted.com/weather/InsideTemp.gif#" + new Date().getTime();/>
    <img alt="Outside Humidity" height="220" width="128" id="reloader3" src="https://cws.a2hosted.com/weather/OutsideHumidity.gif#" + new Date().getTime();"/>
    </p>
</body>
</html>

I need to get those 3 images to reload ignoring the local browsers cache every 3 minutes and the site images change every 3 minutes, but do not change the filename.
Nothing I have tried has worked so far.

Any suggestions.
 
Instead of:

HTML:
src="https://cws.a2hosted.com/weather/OutsideTemp.gif#" + new Date().getTime();

Try:

Code:
src="https://cws.a2hosted.com/weather/OutsideTemp.gif?v=" + new Date().getTime();

I'm not sure that a hash would do anything, but having a parameter at the end of the filename plus the time updating should bust any cache.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom