Post

Automatically open a different browser for specific URLs

Introduction

One of the problems I’ve had for some time is to separate work-related websites from my personal browsing. To solve this I use one browser for all work-related things and another for the rest. However, deciding what should happen when you click on a link is a tedious process and involves copy-pasting it into the right browser. The good news is that can be automated!

Target setup

My target setup is the following:

  1. All work-related sites should go to Firefox. This includes any link I click in Outlook or Teams.
  2. The rest should end up in Safari

These rules should be executed automatically.

Solution

Using Finicky you can easily automate it.

Install it using Homebrew like this:

1
brew install finicky

Then in your home folder create a file called .finicky.js. You can create a skeleton version from the tool but here is my specific configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Generated by Finicky Kickstart 
// Save as ~/.finicky.js

module.exports = {
	defaultBrowser: "Safari",      
	options: {
		// Set to true if you want to debug things in the console
		logRequests: false
	},
	handlers: [
		{
			// Open any link clicked in work apps in Firefox
			match: ({ sourceBundleIdentifier }) =>
			["com.microsoft.Outlook","com.microsoft.teams"].includes(sourceBundleIdentifier),
			browser: "Firefox"
		},
		{
            // TODO: match this to your domains
			match: ["*.myemployer.com/*", "*.myemployer.todo/*"],
			browser: "Firefox"
		}
	]
}

The tool runs unobtrusively with a small icon in the notification area. There you can also do some trouble-shooting if things don’t work as expected.

It’s been working really well for me, hope it is useful for you too!

This post is licensed under CC BY 4.0 by the author.