Javascript DOM HTML Meta httpEquiv Property set

Introduction

Change the value of the http-equiv and content attributes.

The following example will refresh the document every 30 seconds:

View in separate window

<!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>



PreviousNext

Related