Adding Selection Capture to Safari on iOS and iPadOS

Safari on iOS and iPadOS has a nice way to quickly capture the current webpage title and URL into either the Reminders app or the Notes app (and other targets as well). This sharing sheet, which looks like a box with an arrow pointing upward, is present in other application as well. When you share from Safari you will be prompted with a dialog where you can add your own text and select the target list to add the information to. This works fine, but by default it does not use any existing text selection you may have made on the page. You could copy the text before clicking the share button and then paste it, but you can use the Shortcuts app to create a shortcut that will capture that selection before creating either a reminder or a note.

My motivation for creating this shortcut is in support of a GTD-inspired workflow that I am implementing with Reminders and Notes across my Apple devices. (Note: this article only details how to add this functionality to iOS and iPadOS as MacOS does not currently have the Shortcuts app.) The idea with this workflow is that instead of leaving lots of browser tabs open (my usual strategy) I want to file page information as an item in my Reminders Inbox list for later processing. See my blog post Browser Tabs are not Bookmarks or Todos for an explanation of why I am trying this workflow.

I have previously used Shortcuts to create a quick way to set a timer when I start my laundry (this works because the shared laundry service in our condo can be paid for from an app which scans a QR code on the machine so there is an event I can use to trigger the shortcut.) I also have automatic prompts to send arrival and departure texts to my wife when commuting, which not surprisingly hasn’t been in use much this year. Shortcuts lets you define your own collection of actions to expand the capabilities of your mobile device without code (for the most part) and without the need to compile and load an app. It is quite powerful. It can be a bit confusing, especially if you are used to a standard programming language, but poke around am I’m sure you will find the value in it.

You build a shortcut by adding individual actions to the shortcut definition. You can create and set variables, supply conditional logic, prompt the user for information, and use features of many apps that are present on your device. You can also add the shortcut to the sharing sheet, which is why my capture shortcut can be quickly used directly in Safari.

I plan to always send these captures to the Reminders app but I added support for sending to the Notes app because others may prefer that as a target. You could easily add additional app targets and I hope you will modify this base shortcut for your own purpose.

Building the Shortcut Action-by-Action

Shortcut Actions — 1
Shortcut actions — Grabbing the selection

I’ve named the shortcut Capture Safari Selection.

Action 1: Get Details of Safari Web Page. Since this shortcut will be triggered from the sharing sheet in Safari the browser is the front-most app and so the assumption is the capture should be from the current page. By default this action will have Page Contents selected, click the text and change it to Page Selection. Click the text after ‘from’ and select Shortcut Input to gain access to the content from Safari.

Action 2: Make Rich Text from HTML. We don’t want to paste HTML into Reminders or Notes, we want the rich text version of whatever the selection is. Click the ‘Rich Text’ variable placeholder and choose Page Selection.

Action 3: Set Variable. Store the output of Make Rich Text from HTML into a variable called Selection, which we will use later.

Shortcut actions — Setting up variables

Action 4: Text. Here we build a text string that will be used as the default text for the title of the capture. This is ”Capture from: ‘‘ concatenated with the Name of the Shortcut Input, which is the title of the web page. To do this you need to click to add the Shortcut Input into the text area (you may need to scroll the variable list to the left to find it.) Once it is in the Text as Shortcut Input, click on that and choose Name from the list that appears. This drilling-down into elements is used a lot in Shortcuts. Sometimes you made need to use the Selection Magic Variable (the wand icon) to get the value you want. This can be used in place of setting variables but I find setting variables can be easier to understand.

Action 5: Set Variable. Store the text string built in Action 4 into the variable Title.

Action 6: Set Variable. Store the current date and time into the variable Datetime. You can click on Current Date to change the date and time format.

Action 7: Set Variable. Store the URL from the Shortcut Input into the variable URL.

Shortcut actions — Prompting the user

Action 8: Choose from Menu. since I wanted to support capture to either Reminders or Notes I need to ask the user which target they want. Choose from Menu gives us an easy way to add actions to perform based on the user selection. Just rename the prompts.

Action 9: Ask for Input. Place this action in the Reminders block, it should appear slightly indented. With this action we are prompting the user for the Reminder title. Click the Show More and set the Default Answer to the Title variable created in action 5.

Shortcut actions — Creating a reminder

Action 10: Add New Reminder. This is the action that will create the new reminder. There are many options available. First we want to add the Provided Input from the previous action to a specific list in the Reminders app. I’m sending mine to the Input list for later processing. Expand the Show More to see the other options. Set the URL to the URL variable and the body of the reminder to “Captured on: “ plus the Datetime variable. Add a new line (with the return key on the keyboard) and add the Selection variable.

Shortcut action — Creating the note

Action 11: Ask for Text. Just like we did in Reminders we want to prompt the user for the title and provide them with a default (expand Show More to set Default Answer to the Title variable.)

Action 12: Text. Unlike Add New Reminder the creation of a note requires us to build the body of the note ourselves. It begins with Provided Input which is whatever the user sent to us from action 11. Then ‘Captured on:’ is added and followed by the Datetime variable, a new line, and then the Selection variable. Finally we add ‘Captured from:’ and the URL variable.

Action 13: Create Note. The final action of the Notes section and the Shortcut creates a new note with the Text built in action 12. In the Show More enable the Show Compose Sheet. This will let the user choose the destination list in Notes prior to saving the capture.

The Shortcut is complete but there is one option that needs to be enabled so this will be accessible from the Safari sharing menu. Click the ellipsis to the right of the shortcut name to access the details. Enable Show in Share Sheet. Now save the shortcut.

The Shortcut in Action

Safari — Making a selection for capture

Switch to Safari and make a selection on a web page and then scroll the page down to reveal the Safari controls. The middle icon, a box with an arrow pointing up is the sharing menu (sheet). When you click that you will find Capture Safari Selection at the bottom of the list (scroll if needed — you can change the order of this to move the shortcut closer to the top.) Clicking that will trigger the Shortcut and you will be prompted as expected. You can cancel out of the user prompts and nothing will be saved. Progressing through the actions completely will save either a Reminder or a Note (whichever you selected).

Open either Reminders or Notes depending on which target you specified above and you will see the new capture in whichever list you selected.

Reminders — The newly created reminder

There is a lot more that could be done with this Shortcut to add functionality or personalize it. Other app choices could be added. Different layouts, perhaps including font styling and color could be applied to the text of the capture and the meta data. It could be modified to support other source applications. I hope you have found this article instructive and will make your own tweaks and improvements.

Link to the full Shortcut