-->
Page 1 of 1

I NEED THE WEB TO REFRESH AUTOMATICAL AFTER A SECOND

PostPosted: Wed Dec 11, 2019 6:07 am
by TIYANI TEE
I'm reading my inputs and sensor values through the web, the problem is that the information won't be updated in the web till I refresh the web manually. I need a code that will make the web to automatically refresh/reload after a second. Any suggestion?

Re: I NEED THE WEB TO REFRESH AUTOMATICAL AFTER A SECOND

PostPosted: Wed Jan 08, 2020 9:59 am
by Lea
You may need a refresh statement in your web page, sorta like this:
<head><meta http-equiv='Refresh' content='10'>....
This refreshes every 10 seconds.

Re: I NEED THE WEB TO REFRESH AUTOMATICAL AFTER A SECOND

PostPosted: Wed Jan 08, 2020 1:22 pm
by rudy
You can have the page refresh as in the above post, and it is easy. That will cause the page to refresh and the previous content will be erased and replaced. That will cause some flicker.

What looks better is to have the changeable values to be refreshed without having to render the page again. This can be done with some Javascript code.

Web sockets vs Ajax https://www.educba.com/web-sockets-vs-ajax/

Google ESP8266 and Ajax, and then ESP8266 and Websockets. There are lots of examples. Not all searches will give easy to understand examples, so check out a few if you want to go this route.

A page refresh is a lot easier. It just doesn't look as good.