Trigger: Chrome Context Menu on a Link


  • i have a page with a repo
  • on some file links i like to right click
  • then i like to have some "magic" (string replace) and a new url
  • this url should open in a new TAB

Is this possible to have a trigger while right click on a link in chrome?

I don't think so, but you can extract the URL of a hyperlink that you hover over with the Mouse pointer. So you could hover over the hyperlink, and then use a KM Hotkey trigger to do your processing.


MACRO: Create Markdown Link from Hyperlink Under Mouse [Example]

You could easily modify this macro/script to return just the URL. This should do the trick:

JavaScript to Return URL

var linkElem = document.querySelector('a:hover');

var urlStr = '';

if (linkElem) {
   urlStr =  linkElem.href; }


Replace the script in the first Execute JavaScript Action with the above script.