Author Topic: Cache Busting for static plot images. (Was "old images from data plots")  (Read 284 times)

0 Members and 1 Guest are viewing this topic.

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4108
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Decided that I needed a more descriptive Subject line for this.

I have seen the plots on my site that do not get refreshed by the browser that can be several days old.

I tried a random function for my TOA Systems lightning page a while back and basically forgot about it.

I decided to add this to some of my other "static" (as viewed by browsers) chart images.

It works great and I thought that I would pass it along. I have no idea where I found it from some site.

Here is an example line for my website:

Code: [Select]
<img src="http://www.miraculon.com/weatherdata/barograph.png?rand=<?=rand(1,1000);?>" width=660 height=340>
Note that the ?rand=<?=rand(1,1000);? is the business end of this. It seems to generate a random integer between 1 and 1000. This tricks the browser into seeing it as a new image and loads it.

I don't really understand the nuts and bolts about what is going on and "under the hood" of this obviously server-based function, so don't ask me...  #-o

Greg H.
« Last Edit: July 21, 2018, 09:19:46 AM by miraculon »


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF