Closed paalkr closed 5 years ago
I've tested this code and works fine. It refreshes every 5 secs
var buttons = {}
buttons.buienradar = {
width: 12,
isimage: true,
image: 'http://api.buienradar.nl/image/1.0/RadarMapNL?w=285&h=256',
url: 'https://www.buienradar.nl/weer/den_haag/nl/2747373',
refreshimage: 5000
}
You are right, it must have been a miss configuration in my source tree.
The refresh works for some time, but then just stops after a while.
I've made some changes to the refresh mechanism some weeks ago. I assume you use the latest beta.
Your browser will cache the image according the caching settings provided by the server (for instance buienradar). In that case the image may actually not refresh even with a low value for refreshimage.
To prevent caching of the image you may add the parameter forcerefresh: true to the button definition. If this parameter is set then the image-url is extended with the current time, making your browser think it's a new image which it not in the cache yet. However, some servers don't accept the modified url, so this is not always a solution.
Can you test first with the forcerefresh:true parameter?
Thx,
The yr.no service that I pull the advanced meteogram from does respond well with the added t=timestamp parameter. I hope this will force the image to be reloaded each 15 minutes, when using this config.
buttons.yr = {
key:'yr',
width:12, isimage:true, refreshimage:900000,forcerefresh: true,
image: 'https://www.yr.no/sted/Norge/Oppland/%C3%98ystre_Slidre/Beito/advanced_meteogram.png',
url: 'https://www.yr.no/sted/Norge/Oppland/%C3%98ystre_Slidre/Beito/langtidsvarsel.html'
};
BTW, yr.no is a global service, available in Norwegian, English and Sami, with a free and open API.
For yr.no the t=timestamp parameter indeed doesn't work. ny.no detects the additional parameter and replies with a redirect to the original image. This image exists in the disk cache, so there will be no reload.
However, I see that the expiry date of the image is 10 minutes. So the network request that is 10 minutes after the first one will result in a refresh of the image. So if you want to refresh the image as fast as possible, then you can use refreshimage: 601000, forcerefresh: false
btw, I've also found a way to bypass the browser cache. I probably will add this to the next beta release of Dashticz.
Can you please tell us how? Most a cache buster (like time stamp or any other argument) should do the trick
Modify the cache values in the header of the http request via PHP.
Hmm, oké
Thx
Regardless of the value given for refreshimage of a button, the button image is only reloaded when dashticz reloads.