I am developing a small Embedded webserver with some webpages written in CGI, so that whenever I execute a CGI, the code in Webserver will be executed and HTML content is sent to browser. Now if I press refresh continusly only half the page is being displayed on the browser. I have kept a div tag with and Id, so if id is not present i should clear all the HTML content on the browser and reload the same page again.
Now i could not clear the HTML content before reloading the page(because the time to make the request and reload the page is more). So please give me a solution to clear content the HTML page, and reload the page again.
Thanks in advance

You should be able to just , refresh the page ; this will clear HTML on the page.

There are a number of Javascript methods; discussed here, don't use the <meta> tag atall, because it seems you want to 'invoke' the refresh rather than have an automatic (timed) refresh.


If you're trying to send a sparse stream of information at undetermined intervals to any browsers 'watching' a certain URL; you might want to consider AJAX ( An overused term that should relate to Javascript's inbuilt HTTP request objects ); by that means, you can execute very small requests back to your webserver from a page, but without refreshing that page. The server can send back a result, and Javascript in the page can then check the result; either request again, or modify a page based on a result.

You can make basic web-based chat clients for example, using CGI + AJAX - the browser can keep asking the server for changes in the master stream using Javascript's XMLHTTP object, add any new messages to an onscreen-buffer; and handle sending messages back to the CGI, which adds messages to the master stream, and then broadcasts them to any browser that requests a stream update; without needing to refresh the page atall.