title: Prevent default single click event on double click on a link in HTML
body: <p>My code is pretty simple:</p>
  
  <pre><code>var clickCount = 0, clickEl = [];
  var manualClick = false;
  $(document).on('click', 'a', function (e) {
      if (e.altKey || e.ctrlKey || e.shiftKey) {
          return;
      }
      clickCount = clickCount + 1;
      clickEl[clickCount] = this;
  
      var that = this;
      if (1 === clickCount) {
          setTimeout(function () {
              if (2 === clickCount &amp;&amp; clickEl[1] === clickEl[2]) {
                  window.stop();
                  embed_anchor(that);
              }
              clickCount = 0;
          }, 250);
      }
  });
  </code></pre>
  
  <p>It basically checks if there is double click. If yes, it cancel the single click redirect using <code>window.stop()</code>. It used to work great, but I don't know if it's Chrome or my new PC, <code>window.stop()</code> failing 9.5/10 times.</p>
  
  <p>Even a simple code like:</p>
  
  <pre><code>setInterval(function () {
      window.stop();
  }, 1);
  </code></pre>
  
  <p>is not able to prevent redirect these days. Is there any alternative solution for me. I ideally don't want to use <code>e.preventDefault()</code> because this script is part of TamperMonkey and I feel <code>e.preventDefault()</code> will break single click on ton of sites.</p>
  
  <p>Is there any way to hold the event for 250 ms, or cancel and raise the same event (It must behave like last one so no issues with any site). I am open too pretty much everything. I would prefer if my script don't work on some sites rather than breaking any site.</p>