title: Change meta tag content dynamically through javascript
body: <p>I want to change the meta tag content i.e. refresh rate and url dynamically using javascript. Using a button to enable javascript function. Tried 3 alternatives but not working. Please help.</p>
  
  <p>Thanks,Amresh</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta HTTP-EQUIV="refresh" name="description" id="mymetatag"
        content="5;URL=http://localhost:6985/ChartJSDemo/Is_Mainpage.html"&gt;
  &lt;meta charset="ISO-8859-1"&gt;
  
  &lt;title&gt;Processing Details&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/MF_job_failTable.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;button onclick="myFunction()"&gt;Click me&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction() {
      &lt;!--document.querySelector('meta[name="description"]').setAttribute("content","5;URL=http://google.co.in");--&gt;
      &lt;!--document.getElementById("mymetatag").setAttribute("content", "5;URL=http://google.co.in");--&gt;
  
    var m = document.createElement('meta'); 
    m.name = 'description'; 
    m.id = 'mymetatag';
    m.content = '5;URL=http://google.co.in'; 
    m.HTTP-EQUIV= 'refresh';
    document.head.appendChild(m);
  }
  &lt;/script&gt;
  </code></pre>