You know like https:
? That’s a URL Scheme. You’re probably familiar with the concept, thanks to others that come up in front-end development, like mailto:
. You can actually make your own, which is pretty cool. There are a lot of them.
I find that custom URL schemes come up the most with apps that are both web apps and native apps. For example, two that I use nearly every day: Notion and Figma. I love that the things I work on in these apps have URLs. URLs for everything! 🎉
And yet. When I grab the URL to a Notion page, which I do regularly to share with co-workers, I get a URL like…
https://www.notion.so/csstricks/...
That’s fine, and works to open that Notion page in the browser. But I prefer Notion-the-native-app. It’s Electron, so it’s still a web app I guess, but I don’t use it from my web browser, I use it from the application Notion.app
on my literal machine.
Geoff shared with me an article the other day that documents how easy it is to make an application’s browser URL open up in the native app instead:
Fortunately, Notion’s dev team thought about that, and built the
Thomas Frank, “How to Share Notion Links That Open Directly in the App”notion://
link protocol. If you replace thehttps://
portion of any Notion page link withnotion://
, your link will automatically open within the native app instead of a web browser.
That’s great that the native scheme is essentially the same as the web scheme, aside from the name. Thomas goes super deep on this with methods to alter the content of clipboard to replace Notion links with the custom scheme.
I just wanted to note a method I think works nicely for me. The trick isn’t to alter the links themselves, but to react to links that you know are Notion links by redirecting them to open in Notion.app
.
The trick, on Macs, is Choosy:
I prefer to set up Choosy such that it never asks me what browser to use, it just does it based on rules. So under the settings, I have a bunch of apps set up:
For Notion, I watch for links to Notion, and have it open up Notion… that’s it!
The other apps basically do the exact same thing. Works great.
One caveat though! Once in a blue moon, I have to come in here and flip certain applications off. For example, a password reset flow might send me to slack.com
or something, for a certain page as part of the flow that is only available through the web. If Choosy is doing its thing, it tries to force that page to open in Slack.app
, which it won’t, and you can kinda get trapped. So, I have to come in here and flip it off temporarily.
The post Application-Specific Links appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.
source https://css-tricks.com/application-specific-links/
No comments:
Post a Comment