Launching Shortcuts from a web page
Today I learnt a new trick (thanks Jorge Bastida!): how to launch a Shortcut on iOS or macOS from a link on a web page.
Jorge is using that to open the native timer app from his (pretty cool) recipe site, fork.club. But the possibilities are endless.
How it works
It‘s pretty easy:
-
Create a shortcut in Shortcuts.app and give it a nice name (I’m going to pick ‘Good Morning’, because this shortcut will speak ‘Good morning’ when run)
-
Add a link on your web page that triggers the shortcut:
<a href="shortcuts://run-shortcut?name=Good%20Morning">Good Morning</a> -
Click the link, and enjoy the beautiful voice of your computer speaking.
Getting fancy
You can pass arguments to your Shortcut. In my case, instead of speaking a hardcoded ‘Good morning’, my shortcut could receive the text to be spoken with a link like this:
<a href="shortcuts://run-shortcut?name=Good%20Morning&input=text&text=Good%20Morning,%20my%20friend!">Good Morning</a>
We need to change the shortcut a bit to accept the new input:
Moving forward
For all the details about this feature, check out Apple‘s documentation:
Have a nice day!