I'm newbie on java coding.
I have a weather station console (a simple webpage display on Android tablet) which I want to embed a weather forecast into it; and expect it to auto refresh every 1 hour.
The weather forecast code is here:
<a class="weatherwidget-io" href="/" data-label_1="PHRA KHANONG" data-label_2="WEATHER" data-font="Arial Rounded MT Bold" data-icons="Climacons" data-theme="dark" data-textColor="#d7e614" data-highColor="#f59c65" data-lowColor="#09cef1" >PHRA KHANONG WEATHER</a>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=".min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","weatherwidget-io-js");
I can embed it into my webpage, but I would like it to auto update every 1 hour. Please help.
Thank you
I'm newbie on java coding.
I have a weather station console (a simple webpage display on Android tablet) which I want to embed a weather forecast into it; and expect it to auto refresh every 1 hour.
The weather forecast code is here:
<a class="weatherwidget-io" href="https://forecast7./en/13d69100d61/phra-khanong/" data-label_1="PHRA KHANONG" data-label_2="WEATHER" data-font="Arial Rounded MT Bold" data-icons="Climacons" data-theme="dark" data-textColor="#d7e614" data-highColor="#f59c65" data-lowColor="#09cef1" >PHRA KHANONG WEATHER</a>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://weatherwidget.io/js/widget.min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","weatherwidget-io-js");
I can embed it into my webpage, but I would like it to auto update every 1 hour. Please help.
Thank you
Share Improve this question edited Jan 6, 2018 at 3:45 bthoven asked Jan 6, 2018 at 2:19 bthovenbthoven 151 silver badge4 bronze badges 1- 4 Please provide code samples and tag your question appropriately. Java and Javascript are 2 different languages. The code samples should be contained within your initial post and not in a ment. – Pyromonk Commented Jan 6, 2018 at 2:21
3 Answers
Reset to default 6Use the following code to refresh the weather widget every hour:
setInterval('__weatherwidget_init()', 3600000)
you can use setInterval(callbackFn, timeinMS) method in javascript to call after some interval.
You can also do it in HTML, this will refresh every 60 seconds:
<meta http-equiv="refresh" content="60">