0

There're very similar questions/solutions. And I think they already answer my question with basically "no, it's not possible". But they're all more specific cases so I wanted to double check 1 last time for the general case before giving up on this approach.

Basically, I want to know when an <a href=...> is followed.

  • click event listener will capture left-click, ctrl + left-click, and keyboard activation (e.g. tab focus + enter), but not middle-click.
  • mouseup event listener will capture middle-click, but then I'd have to have additional logic to make sure it's not a drag event.
  • Neither event listener will capture right-click + 'open link in *' events.

The links won't be to the same domain, so trying to get the loaded pages to communicate on load won't be possible.

junvar
  • 11,151
  • 2
  • 30
  • 46
  • 1
    This might help https://stackoverflow.com/q/15944572/13983399 – BeerusDev Sep 07 '21 at 20:59
  • 1
    An easier approach then trying to detect all possible user interactions with a link element would be to make the links go through some server script that would record the navigation and then do a redirect, eg `yoursite.com/linkscript?url=http://example.com` – Patrick Evans Sep 07 '21 at 21:01
  • 1
    @BeerusDev, unfortunately, that confirms the "no, it's not possible" answers I've been seeing. Though one of the answers does provide an interesting alternative similar to what PatrickEvans mentions. – junvar Sep 07 '21 at 21:51
  • @Quentin, you can already do that with left clicks, why would it be any more of a flaw to be able to do that with middle clicks or right clicks? I don't care what links they clicked on while on their banking page. I only care what links they click on when on my page. – junvar Sep 07 '21 at 21:52

0 Answers0