Web Weather > Weather Website PHP/AJAX scripting
Refresh radar image
(1/1)
ValentineWeather:
Is there a way to just refresh the NWS radar. It needs to refresh every 3 minutes, but to do that I'm having to refresh the full page, which restarts the streaming camera. Currently using this code but refreshes full page.
<meta http-equiv="refresh" content="180 " />
The code below is the NWS radar GIF, I would like to refresh every 3 minutes and not the full web page: Is it possible?
<td width="100%" ><div align= "center"><a href="https://radar.weather.gov/ridge/standard/KLNX_loop.gif" target="_blank" data-lightbox="image-1" data-title=" "><img src="https://radar.weather.gov/ridge/standard/KLNX_loop.gif" width="360" height="270" style="margin: 0px; padding: 0px; border: none"></a></div></td>
Website: https://www.valentinenebraska.net
Thanks
Cutty Sark Sailor:
This'll refresh the image only at 3 seconds (3000msec)... you can figure your "link'n'lightbox'n'etc"...
--- Code: ---<img
src="https://radar.weather.gov/ridge/standard/KLNX_loop.gif?&t=" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 3000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 3000)' alt='KLNX Loop 3 Sec Refresh'>
--- End code ---
92merc:
Here's another old tidbit. Set to 10 seconds, but you can change that.
https://www.wxforum.net/index.php?topic=43884.msg446793;boardseen#new
ValentineWeather:
Thank you so much Cutty that worked. =D>
I did figure out how to make it work with lightbox.
Thanks for the tip 92Merc.
ValentineWeather:
In the event someone else needs the lightbox full code I used:
<td width="100%" ><div align= "center"> <a href="https://radar.weather.gov/ridge/standard/KLNX_loop.gif" target="_blank" data-lightbox="image-1" data-title=" "><img src="https://radar.weather.gov/ridge/standard/KLNX_loop.gif?&t=" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 3000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 3000)' alt='KLNX Loop 3 Sec Refresh' width="350" height="270" style="margin: 0px; padding: 0px; border: none"></a></div></td>
Navigation
[0] Message Index
Go to full version