How to Open Current Webpage in Safari From MS Edge and Vice Verse?

It seems that only chrome and safari have the token.

Method 1

This will make Microsoft Edge work with the JavaScript action in KM:

JavaScript works after running these commands in the Terminal:

defaults write com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeBundleID -string >"com.microsoft.edgemac"
defaults write com.stairways.keyboardmaestro.engine BrowserGoogleChromeName -string "Microsoft >Edge"

See this post:

Then you'll be able to use the %FrontBrowserURL% token, like this:


The customization above will allow the %FrontBrowserURL% token to work with Microsoft Edge.

Method 2

If you are not comfortable with the customization given above, you may use these actions:


This will also work with Firefox which does not have JavaScript via AppleScript Event support.

It works. But I have 2 more questions:

  1. Is that possible to have Safari, Chrome, Edge all in the menu, instead of replace Chrome with Edge?

  2. Some other scripts now doesn't work, please see the picture below.

I’m not on my Mac now. So I’ll just offer some thoughts for you.

Yes. Use a prompt with list action, make a list of the desired browsers, save your selection to a variable, use this variable in a switch action to decide which browser to open the link.

I’m not sure what’s going on. Maybe you’re trying to act on Safari?
I usually prefer the Execute JS in Front Browser action, as it works in both Safari and Chromium based browsers.
Edit: my guess about the 2nd question is probably wrong, as this action would probably still work even if you have switched to Safari. Have you tried other JS on Edge?
I did a search and found there is an equivalent JS command for your purpose:

Yes can be used in Chrome and Safari.

Even I used Alert("test"); still got same error with either "Edge" or "Front Browser".

I solved it. Just simply enabled Tools > Developer > Allow Javascript from Apple Events on MS edge.

1 Like