macossafarispotifydeep-linkingcustom-protocol

Deep links in Spotify as the best practice


I am researching the way Spotify registers its custom protocol scheme in macOS Catalina (Spotify URI).

Spotify uses custom URIs of the following format (notice the absence of slashes)

spotify:track:2nI9BfzCrSWZnCkpF2Nn6O

When I take this link and paste it in the Safari address bar, Safari recognizes it as a valid link and navigates to the app correctly.

None of other custom protocol schemes I have checked on macOS are recognized by Safari in the same way (if no slashes are present).

The general recommendation is to include the scheme in the apps Info.plist file. I have tried that as well, but a deep link with no slashes was not recognized - Safari runs a web search instead.

What am I missing?


Solution

  • As correctly pointed out by a friend, this seems to be a one-off fix specifically for Spotify, as 'spotify' is whitelisted in SafariShared.framework:

    hopper

    As you can see, the custom protocol is hardcoded.