Change the value of the http-equiv and content attributes.
The following example will refresh the document every 30 seconds:
<!DOCTYPE html> <html> <body> <meta http-equiv="content-type" content="text/html"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w w w. j ava 2 s . c om document.getElementsByTagName("META")[0].httpEquiv = "refresh"; document.getElementsByTagName("META")[0].content = "30"; document.getElementById("demo").innerHTML = "The document will refresh every 30 seconds."; } </script> </body> </html>