Based on [Wayback/Archive] javascript – how to refresh an iframe automatically – Stack Overflow and help fromĀ [Archive] Roderick Gadellaa (@RGadellaa) / Twitter, I used this JavaScript code right after the body in the html page to reload part of the iframes every 3 minutes and another part every 3 hours:
<script> var iframes3minuteInterval = setInterval( () => { const ids3minutes = [ 'agenda_iframe', 'month_iframe' ]; ids3minutes.forEach( id => { element = document.getElementById( id ); element.src = element.src; }); }, 1000 * 60 * 3); var iframes3hourInterval = setInterval( () => { const ids3hours = [ 'weerplaza_nederland_iframe', 'weerplaza_radar_iframe', 'buienradar_iframe' ]; ids3hours.forEach( id => { element = document.getElementById( id ); element.src = element.src; }); }, 1000 * 60 * 60 * 3); </script>
The iframes are widgets for:
- Google Calendar, see: Some ideas to show a Google Calendar on a TV using a Raspberry Pi and HDMI output.
- Buienradar (which you can configure at [Wayback/Archive] Buienradar.nl – Actuele neerslag, weerbericht, weersverwachting, sneeuwradar en satellietbeelden):
- Weather radar: [Wayback/Archive] Mijn Buienradar: Breda (it zooms in more than the Weerplaza regenradar, since most wind is from the south-western direction, Breda gives a better view).
- Weerplaza (which you can configure at [Wayback/Archive] Weerwidgets – gratis weer op je eigen site – Weerplaza.nl):
- Weather radar: [Wayback/Archive] Weerplaza regenradar: Sassenheim.
- Weather forecast: [Wayback/Archive] Weerplaza verwachting: Sassenheim.
This was to workaround GitLab pages on a custom domain are nice, but be aware of intermittent 502 and certificate errors. Now the page only gets loaded once, and the widgets at intervals that are needed.
—jeroen