title: Can I stop a meta refresh using javascript?
body: <p>The following code allows the user to stop the meta refresh from happening - and it successfully removes the <code>meta refresh</code> from the page, but the browser nonetheless refreshes the page. Any idea how to make it work?</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Test&lt;/title&gt;
  &lt;meta charset="UTF-8" /&gt;
  &lt;meta http-equiv="refresh" content="5" id="refresh" /&gt;
  &lt;script src="//code.jquery.com/jquery-1.11.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(function(){
    $("a").click(function(e){
      e.preventDefault();
      $("#refresh").remove();
    });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  Reloaded at &lt;span id="time"&gt;&lt;/span&gt;
  &lt;script&gt;
  document.getElementById("time").innerHTML = Date();
  &lt;/script&gt; 
  
  &lt;a href="#"&gt;Stop refresh&lt;/a&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>EDIT: this is different from <a href="https://stackoverflow.com/questions/3252743/using-javascript-to-override-or-disable-meta-refresh-tag">this question</a> because that question wants a fallback solution for users not supporting javascript - this is not the case for me (most of the answers to that question do not apply to this question).</p>