-->
Page 2 of 2

Re: How can i refresh a webpage on an ESP8266WebServer?

PostPosted: Tue Jun 09, 2020 12:30 pm
by AcmeUK
In general a Web server responds to a PULL request from a browser.

What you are trying to do is PUSH data from the server to a browser client.

Try searching Google for "HTML PUSH"

Have a look here to get you started :- http://www.instructables.com/id/Push-Data-From-ESP-Webserver-to-Client/

Re: How can i refresh a webpage on an ESP8266WebServer?

PostPosted: Wed Jun 10, 2020 3:27 am
by Tertius21
Thank you for this information. Sounds interesting. And for other projects also.

Re: How can i refresh a webpage on an ESP8266WebServer?

PostPosted: Sat Oct 02, 2021 10:10 am
by fra589
Hi,
Perhaps it's not too late for a reply...

Code: Select all  server.sendHeader("Location", "/file", true);
  server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
  server.sendHeader("Pragma", "no-cache");
  server.sendHeader("Expires", "-1");
  server.send(302, "text/plain", "");
  server.client().stop(); // Stop is needed because we sent no content length


This force reload as it disable caching on client side.

@++;

Re: How can i refresh a webpage on an ESP8266WebServer?

PostPosted: Sat Apr 29, 2023 2:50 pm
by mtokeyboard
freddy-a wrote:The webserver does not actively push pages.
Your browser has to request a page from the webserver.

If you upload a new page to your webserver, nothing is going to trigger your browser (or the webserver) to refresh the page.

You could put a command in your page (the you've opened with your browser) that refreshes the page every ## seconds.

This is the HTML command:
<meta http-equiv="refresh" content="30">

And this would (probably) be the string in your ESP8266 code:
ptr +=" <meta http-equiv=\"refresh\" content=\"30\">\n";

This should be placed within the HEAD tag!



THANKS :D IT HELPED ME !!