title: stop redirecting page if it is redirecting by clicking on anchor
body: <p>I want to prevent page redirecting I know it can be achieve by this</p>
  
  <pre><code>window.onbeforeunload = function() {
          return "Dude, are you sure you want to leave? Think of the kittens!";
  }
  </code></pre>
  
  <p>which was answered here <a href="https://stackoverflow.com/questions/3527041/prevent-any-form-of-page-refresh-using-jquery-javascript">Prevent any form of page refresh using jQuery/Javascript</a></p>
  
  <p>But in my case I only want to prevent page when it is redirecting by clicking on any of the anchor tag.</p>
  
  <p>Also <code>event.preventDefault()</code> will not work in my case while clicking on anchor tag because all anchors are not redirecting page so it should work fine.</p>
  
  <p>I only want to stop redirecting page if it is redirecting by clicking on anchor. Any solution?</p>