How to option-click on a browser link

I can click on a link that points to a pdf. However, it opens the pdf in the browser window.
I know that option-click downloads the pdf, which is what I want

  • How do I do option-click using the KM action “Click Google Chrome Link”?
  • Alternatively, how can I option click using javascript?
    I can successfully click on this link using .click() on the link tag

I have NOT tested this, but you might try:


Hi Michael,I tested your proposed solution. Regret that it didn’t have the effect of an option-click.Will keep trying.Thanks.S

Well, that’s too bad.

Have you tried manually holding down the OPT key, then triggering the KM macro with the click on link action?

Sorry, that didn’t option-click the link either. Just an unmodified click.

Having the same issue with clicking links using modifier (command)
It doesn't open a new browser tab on the right using "Press and Hold Command Modifier"

But works with holding CMD before triggering a macro.

Any ideas on how to make it work?

You might try a custom JavaScript in Browser where you open the target in a new tab/window.

I have built an AppleScript for this action, what is does:

  1. Gets a link from a KM variable.
    The target URL may be extracted from xpath using @JmichaelTX's script Copy the url address of the xPath

  2. Opens target URL in a new Safari tab, on the right after current active tab

  3. If KM variable with the target link is blank then a new tab won't be opened

The code:

tell application "Keyboard Maestro Engine"
   set myASVar to getvariable "Link"
   tell application "Safari"
      tell window 1 of application "Safari"
         get index of current tab
         set myActiveTab to current tab
         if myASVar is not "" then
            set myTab to make new tab at after myActiveTab with properties {URL:myASVar}
         end if
      end tell
   end tell
end tell