Safari (for Mac) URL Scheme

This will open my website in Safari on macOS, no matter your default browser:

x-safari-https://christiantietze.de

Try it!

Depending on your platform and browser, this may not be clickable or not do anything (I have no clue what Android browsers would do with this).

I was looking for this because I was dissatisfied with how I tabbed into Safari in a screencast recently.

With a link like this, I can open Safari from my notes, e.g. from within The Archive during demonstrations.

For mobile Safari on iOS, it’s apparently com-apple-mobilesafari-tab:https://christiantietze.de, but I haven’t tested that yet. Using Shortcuts you can reveal this.

All of Safari’s URL Schemes

There haven’t been a lot of useful references on the web, so I looked myself; how do you figure out which URL Scheme an app supports?

  1. Locate the .app bundle; for Safari, since it’s in a protected system folder, it’s easiest to search for “Safari” in Spotlight (+ (that’s the space key)) and then reveal the match in Finder (+R).
  2. Right-click the app, “Show Package Contents”;
  3. inside the Contents/ folder,
  4. view the Info.plist file in a text editor of your choice.
  5. Search for CFBundleURLTypes. This key is associated with an array of values (you’ll notice these as they are indented a bit to the right).

This is the relevant section from Safari’s Info.plist as of today in Ventura:

<key>CFBundleURLTypes</key>
<array>
  <dict>
	<key>CFBundleURLName</key>
	<string>Web site URL</string>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>http</string>
	  <string>https</string>
	</array>
	<key>LSHandlerRank</key>
	<string>Default</string>
	<key>LSIsAppleDefaultForScheme</key>
	<true/>
  </dict>
  <dict>
	<key>CFBundleURLName</key>
	<string>Local file URL</string>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>file</string>
	</array>
	<key>LSHandlerRank</key>
	<string>Default</string>
  </dict>
  <dict>
	<key>CFBundleURLName</key>
	<string>Safari Start Page</string>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>x-safari-https</string>
	</array>
  </dict>
  <dict>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>prefs</string>
	</array>
	<key>LSHandlerRank</key>
	<string>None</string>
  </dict>
  <dict>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>x-webkit-app-launch</string>
	</array>
	<key>LSHandlerRank</key>
	<string>None</string>
  </dict>
</array>

Apart from http and https, Safari also registers for the file protocol.

Then you see x-safari-https, prefs, and x-webkit-app-launch.