Route Links to the Right Browser on Windows, macOS, and Linux

Problem:

You use more than one browser, or more than one browser profile, and you use more than one operating system. Work links should open in your work profile, personal links in your personal browser, and banking in something locked down. But every OS gives you exactly one default browser, and every link lands there — the Jira link from Slack, the Google Doc from Outlook, the bank statement from your email. You end up copying URLs from one browser window to another all day.

Now do that on a Windows work laptop, a Mac at home, and a Linux desktop in the office. Three machines, three different ways to (not quite) fix it.

Root Cause:

Every desktop OS maps the http and https URL schemes to a single application. When any app opens a link, the OS hands the URL to that one handler. Browsers have grown profiles and containers, but the OS still thinks in terms of one browser for everything. Each OS also stores that choice in a different place.

On Windows, the choice is a ProgId under your user’s registry hive:

Plain text
Copy to clipboard
reg query HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice /v ProgId
reg query HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice /v ProgId

The UserChoice key is protected by a hash, so an app cannot quietly make itself the default. You must pick it yourself in Settings → Apps → Default apps.

On macOS, Launch Services keeps the handler for each URL scheme:

Plain text
Copy to clipboard
defaults read com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers | grep -A2 'LSHandlerURLScheme = https'
defaults read com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers | grep -A2 'LSHandlerURLScheme = https'

On Linux, the freedesktop.org MIME system maps x-scheme-handler/https to a .desktop file, stored in ~/.config/mimeapps.list:

Plain text
Copy to clipboard
xdg-settings get default-web-browser
xdg-mime query default x-scheme-handler/https
xdg-settings get default-web-browser
xdg-mime query default x-scheme-handler/https

The DIY Fix (Linux Only):

Because the handler is just a program that receives a URL, you can register your own small router. On Linux this takes two files. First, a script that picks a browser based on the URL:

Plain text
Copy to clipboard
#!/bin/sh
# ~/.local/bin/route-url
case "$1" in
*atlassian.net*|*docs.google.com*)
exec google-chrome --profile-directory="Profile 1" "$1" ;;
*yourbank.com*)
exec firefox --private-window "$1" ;;
*)
exec firefox "$1" ;;
esac
#!/bin/sh
# ~/.local/bin/route-url
case "$1" in
  *atlassian.net*|*docs.google.com*)
    exec google-chrome --profile-directory="Profile 1" "$1" ;;
  *yourbank.com*)
    exec firefox --private-window "$1" ;;
  *)
    exec firefox "$1" ;;
esac

Then a desktop entry that tells the system this script handles web links (use your full home path; Exec does not expand ~):

Plain text
Copy to clipboard
[Desktop Entry]
Type=Application
Name=Route URL
Exec=/home/you/.local/bin/route-url %u
MimeType=x-scheme-handler/http;x-scheme-handler/https;
NoDisplay=true
[Desktop Entry]
Type=Application
Name=Route URL
Exec=/home/you/.local/bin/route-url %u
MimeType=x-scheme-handler/http;x-scheme-handler/https;
NoDisplay=true

Save it as ~/.local/share/applications/route-url.desktop, then make it the default:

Plain text
Copy to clipboard
chmod +x ~/.local/bin/route-url
xdg-settings set default-web-browser route-url.desktop
chmod +x ~/.local/bin/route-url
xdg-settings set default-web-browser route-url.desktop

Why the DIY Fix Doesn’t Scale:

It works, but only on that one Linux box. On macOS the router must be an app bundle that declares the URL schemes in its Info.plist and registers with Launch Services. On Windows it must register a ProgId and a Capabilities key in the registry before it even shows up in Default apps. Browser profiles are named differently everywhere too: Chrome wants a profile directory such as Profile 1, Firefox wants -P <name>, and the paths change per OS. So you maintain three routers with three copies of the same rules — and there’s still no way to choose a browser by hand for the one link that doesn’t fit a rule.

Solution:

Put one router on every machine. OpenWith is a cross-platform browser chooser: a native desktop app that registers as your default browser on Windows, macOS, and Linux and gives you the same picker, the same URL rules, and the same browser profiles on each OS. Full disclosure: we build it — OpenWith is made by SmartAppsCo, and it has been the fix for exactly this problem on our own mixed Windows/Mac/Linux setups.

The OpenWith browser picker, listing installed browsers and profiles

When you click a link in any app, OpenWith either:

1. Opens it right away in the browser or profile a rule picks (for example, atlassian.net → Chrome – Work), or
2. Shows a small picker so you choose per link — click a browser, or use the arrow keys and Enter.

Rules are simple text matches (github.com also matches gist.github.com), checked top to bottom, and the first match wins. That’s the same case statement from the script above, without the script — and it carries over to every OS. OpenWith finds installed browsers and the profiles inside Chrome, Edge, Brave, Vivaldi, Chromium, and Firefox, so “Chrome – Work” and “Chrome – Personal” are separate choices. A typical setup:

Work: Jira, Confluence, Google Workspace, Microsoft 365 → work profile
Personal: social media and shopping → personal browser
Private: banking and health → a separate, locked-down browser
Everything else: → the picker

Set It Up:

Windows: Run the installer. In OpenWith, open Settings and click Set as Default, then choose OpenWith as your web browser in Default apps (the UserChoice hash means Windows makes you confirm this yourself).

macOS: Drag OpenWith to Applications, click Set as Default in Settings, and confirm when macOS asks to change the default browser.

Linux: It ships as a single AppImage:

Plain text
Copy to clipboard
chmod +x ~/Downloads/OpenWith-linux.AppImage
~/Downloads/OpenWith-linux.AppImage
chmod +x ~/Downloads/OpenWith-linux.AppImage
~/Downloads/OpenWith-linux.AppImage

In Settings, click Register (this writes the desktop entry for you), then Set as Default. If you move the AppImage later, register it again.

Links Inside the Browser:

One gap no OS-level handler can close: a link you click inside a browser stays in that browser, because the OS never sees it. OpenWith has extensions for Chrome and Firefox for this. Alt-click a link, or right-click it and choose Open with OpenWith, and it goes through the same rules and picker.

Cost:

The free version needs no account and includes the picker, 2 browsers, and 3 rules — enough for a simple work/personal split. Pro is a $20 one-time purchase (not a subscription) for unlimited browsers and rules, auto-open with a delay, and URL rewriting. If you’re coming from a single-platform picker, here’s how it compares as a cross-platform alternative to Choosy and BrowserPicker.

Verify:

Run the check for your OS from the Root Cause section. On Linux, xdg-settings get default-web-browser should now name the OpenWith desktop entry. On Windows, the ProgId should belong to OpenWith, and on macOS the https handler should be OpenWith’s bundle ID. Then click a link in Slack, Teams, or your mail client: it should open in the browser your rule picks, or show the picker.

Every link in its place. Carry on.

You may also like...