I am writing a HTML application for an Arduino-based web server using only C and C++ on the Arduino webserver and HTML only on the client web browser.
The index page is a simple form containg two radio buttons and a 'Submit' button BUT at the top of the page is the encoded day and date extracted from a real-time clock chip attached to the Arduino.
I want to re-transmit the entire page ( < 400 bytes) every 5 seconds with an updated time.
I have no trouble encoding and transmitting the encoded page the first time but thereafter the browser just sits displaying the original page with the original time, even though debugging printout from the Arduino says that it is transmitting a new page every 5 seconds.

How do I get the Arduino to tell the Browser to forget the last index page and receive a new one - using HTML only?'

Recommended Answers

All 3 Replies

My classic understanding of this is you can't just send a new page and the browser update. So let's step back to how a browser in the most simplest way works. For simplicity the browsesr is called "browser" and your web server is called "server."

Browser starts up and you type in some URL. Then the request is made and the server responds. Server sends the HTML and once the end is done, anything else is ignored by the browser.

So how to update in 5 seconds? In your server, replies in the HTML code to reload the page in some number of seconds. Try the refresh code such as http://www.beansoftware.com/HTML-CSS-FAQ/Refresh-Page-After-X-Seconds.aspx

There are more advanced ways that you would code up, but let's go with simple.

Thank you. Thank you. That was just the bee's knees.
Has been implemented and works a treat as the page being refreshed is only very small (less than 500 characters) and is probably smaller than the request the browser sends every 5 seconds!

Sorry for the spelling error there and glad it helped. You can click the Not Yet Answered button if this is working for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.