Author Topic: Help with forcing load of most recent images  (Read 561 times)

0 Members and 1 Guest are viewing this topic.

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Help with forcing load of most recent images
« on: July 05, 2019, 08:29:09 PM »
I'm experiencing some trouble getting the most recent images on a couple of pages to load rather than older images.

See here:
https://www.hburg-wx.net/wxgr3radar.php

In my browser I have to press "SHIFT" and browser refresh button to force load of the most recent GRLEVEL3 images that I'm uploading.

Likewise my most recent 1-wire uploaded lightning graph wants to hold onto older images too long.
https://www.hburg-wx.net/wxlightning.php
(looking at the Local Strike Activity - Lightning Counter).

Thanks in advance if you have any suggestions.

steve

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help with forcing load of most recent images
« Reply #1 on: July 05, 2019, 10:53:51 PM »
Your server is emitting the correct cache-busting headers, so a simple page reload (without the shift) should suffice to bring in the updated image content.  Even the wxgr3radar.php images have ?t=<unix-timestamp> on the URLs to force the browser to not cache.

I'm using the latest Firefox and it's working fine on both pages (simple page reload, without shift gets fresh content).

What browser are you using?
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Re: Help with forcing load of most recent images
« Reply #2 on: July 06, 2019, 02:03:05 PM »
Thanks for taking at look at this Ken!

What I see is in the following images.  Both images are displayed on a freshly opened browser (Chrome and Windows Edge).  I see the same thing on my iPad Pro using Safari and Chrome and cell phone browser (Android running Chrome).

 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

You’ll see the time stamp in the lower right corner is the correct machine time but the image that comes up is from last night.  Hitting the refresh button on none of the browsers refreshes the image but a hard refresh does as is shown below.

 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

Are you aware of any php coding that I could use that would force a fresh load of these images?

steve

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live
Re: Help with forcing load of most recent images
« Reply #3 on: July 06, 2019, 06:13:45 PM »
You might try this in your meta section:
Code: [Select]
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />


Doug

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Help with forcing load of most recent images
« Reply #4 on: July 06, 2019, 06:36:24 PM »
M$ IE11 of course does strange things ....

Snippet from confusing M$ article https://support.microsoft.com/en-gb/help/234067/how-to-prevent-caching-in-internet-explorer

Quote
HTML pages allow for a special HTTP-EQUIV form of the META tag that specifies particular HTTP headers from within the HTML document. Here is a short example HTML page that uses both Pragma: no-cache and Expires: -1:

<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD><BODY>
</BODY>
</HTML>

Pragma: no-cache prevents caching only when used over a secure connection. A Pragma: no-cache META tag is treated identically to Expires: -1 if used in a non-secure page. The page will be cached but marked as immediately expired.

Imagine what you will KNOW tomorrow !

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Re: Help with forcing load of most recent images
« Reply #5 on: July 07, 2019, 03:19:28 PM »
Thanks for the suggestions!  But unfortunately I didn't seem to work.

This issue seems strange as I only have these image update issues on the two pages that I've listed.  All other images seem to update to most recent versions with no problem.