Home : Support : macOS Safari

StopTheMadness for Safari
URL Scheme Rules and Web URL Rules

StopTheMadness for Safari has the ability to automatically open clicked links in other apps, according to your preferences. You can define rules in StopTheMadness that specify which links open in which apps. Rules are defined in two different ways: by URL scheme, for example mailto, or by full URL, for example, https://docs.google.com. In StopTheMadness, select the "URL Scheme Rules" tab to define the former and the "Web URL Rules" to define the latter. The Web URL Rules handle links with the http or https scheme, while the URL Scheme Rules handle links with all other schemes (not http or https). The reason for the difference is that web URLs have a strict format with domains and paths that are understood by every web browser, whereas URLs with custom schemes may have a completely private format understood by only one app.

Tip: This feature works with ⌘-click as well as normal click. The reason is that many people ⌘-click links by habit, and you might not realize that the link matches one of your rules until after you click. If one of your rules is matched, then the link will be opened in the specified app instead of in a new tab.

URL Scheme Rules

This feature is enabled by default, but there are no rules by default, so it has no effect until you define some rules. If you define some rules, but you want to temporarily disable the rules without deleting them, just uncheck the checkbox at the top.

URL Scheme Rules tab

To define a new rule, click the + button and enter a URL scheme. Do not add the ":" character at the end of the scheme. You can only define one rule per scheme, and you cannot define rules for the http or https schemes. (Use Web URL Rules for an http or https URL.)

The "Open Clicked Link With" popup menu allows you to specify what happens when you click a link in Safari that has a certain URL scheme. The menu lists every app that can handle the URL scheme. The menu also contains the items "Default app for scheme" and "Don't open clicked link". If you select "Default app for scheme", then clicking a link with that scheme in Safari will open the default handler for that scheme, whichever app it happens to be at the time you click the link. If you select "Don't open clicked link", then clicking a link in Safari with the specified URL scheme will do nothing! The click will be cancelled. You may want this option to avoid accidentally opening an app, for example.

Open Clicked Link With popup

StopTheMadness only handles clicks on links with URL schemes that you've specified in your rules. Links with other URL schemes are handled by Safari as usual.

To delete a rule, select it in the list and press the - button. You can also use the Delete main menu command or its keyboard shortcut.

When you change your URL Scheme Rules, the change applies immediately to the active Safari tab, and will apply to all web pages loaded thereafter in any tab. If you already had a web page open in a background tab before you changed the rules, and you want the change to apply immediately to that web page, you need to switch to the tab and reload the page.

Web URL Rules

This feature is enabled by default, but there are no rules by default, so it has no effect until you define some rules. If you define some rules, but you want to temporarily disable the rules without deleting them, just uncheck the checkbox at the top.

Web URL Rules tab

To define a new rule, click the + button, and then edit the URL. You can use http* to match both http and https URLs. Without the * character, the http or https scheme must be matched exactly in the link. You can also use the * in front of the URL domain to automatically match subdomains. For example, *google.com will match google.com or www.google.com or docs.google.com. Without the * character, the URL domain must be matched exactly in the link. URL paths are automatically matched; don't put a * character at the end of the URL. If you want to match only specific URL paths, you can put the path at the end of the URL. For example, https://www.google.com/maps will only match Google Maps, not Google Search.

Web URL Rules are evaluated in order. The first rule to match the clicked link determines the action. You can drag and reorder rules in the list. In most cases, the order of the rules shouldn't matter, unless you have multiple rules that cover the same URL domain.

The "Open Clicked Link With" popup menu allows you to specify what happens when you click a link in Safari that has a certain web URL. The menu lists every web browser on your Mac. The menu also contains the items "Default web browser" and "Don't open clicked link". If you select "Default web browser", then clicking a link with that URL in Safari will open your default web browser, whichever app it happens to be at the time you click the link. If you select "Don't open clicked link", then clicking a link in Safari with the specified URL will do nothing! The click will be cancelled. You may want this option to avoid accidentally opening certain web sites, for example.

Open Clicked Link With popup

StopTheMadness and Link Unshortener were designed to work together. Link Unshortener counts as a web browser, because it can handle http and https links! Link Unshortener also automatically reads and follows your StopTheMadness Web URL Rules. You can even set Link Unshortener as the default web browser on your Mac, so it will follow your StopTheMadness rules when you open links from other apps such as Mail. For more information, see Link Unshortener support.

StopTheMadness only handles clicks on links with URLs that you've specified in your rules. Links with other URLs are handled by Safari as usual.

To delete a rule, select it in the list and press the - button. You can also use the Delete main menu command or its keyboard shortcut.

When you change your Web URL Rules, the change applies immediately to the active Safari tab, and will apply to all web pages loaded thereafter in any tab. If you already had a web page open in a background tab before you changed the rules, and you want the change to apply immediately to that web page, you need to switch to the tab and reload the page.

Non-clicked Web URLs

By default, StopTheMadness Web URL Rules only handles links that are clicked in Safari. If you want your Web URL Rules to apply also to redirects and to links that were clicked in another app, such as Mail, you need to enable the option "Handle non-clicked URLs too", and you need to make sure that "Preload Top Hit in the background" is disabled in the Search pane of Safari's Preferences window, because this StopTheMadness feature is incompatible with Preload Top Hit. For more information about the incompatibility, and about the Safari preference Preload Top Hit in the background, see my blog post.

Confirm Checkboxes

Each URL Scheme and Web URL rule has a Confirm checkbox, which is disabled by default. If you enable Confirm, then StopTheMadness will show a confirmation alert whenever you click a link in Safari that is handled by the rule. If the rule is defined to open the link in another app, then clicking OK or pressing return will open the link in that app, whereas clicking Cancel or pressing escape will bypass the StopTheMadness rule and let Safari handle the link.

Web URL Rules tab

If the rule is "Don't open clicked link", then the actions are switched: clicking OK or pressing return will let Safari handle the link, whereas clicking Cancel or pressing escape will simply prevent the link from opening at all.

Web URL Rules tab

Home : Support : macOS Safari