title: How to edit href of a right-click that's opened via right-click "open in new window" using jquery
body: <p>I'm appending a string to the HREF for outgoing links on my site, it works like this. I need to append it on click because although I wrote it as a string here, it's generated at the time of click so I can't just append it to all the links before any clicking happens:</p>
  
  <pre><code>//middle-click
  $(document).on("mousedown", function (e1) {
      $(document).one("mouseup", function (e2) {
          if (e1.which == 2 &amp;&amp; e1.target == e2.target) {
              var e3 = $.event.fix(e2);
              e3.type = "middleclick";
              $(e2.target).trigger(e3)
          }
     });
  });
  
  $('a[href*="link.php"]').on('click middleclick', function(e) {
      let link = this.getAttribute('href');
      e.preventDefault();
      window.open(`${link}`+`&amp;appended=1`);
  });
  </code></pre>
  
  <p>So this works for clicks and clicks with middle mouse button BUT what about users who right-click and open in a new window/tab? How do I detect this in jquery?</p>