How to use the Share sheet to send a message with the front tab data

Daron asked on Mastodon:

What I was looking to do was add a ‘Share’ extension to Brave so I could easily share into email or Messages etc, as you can in Safari.

That’s a good question! All browsers are able to share the current page (URL) via the Share Sheet, and when a workflow specifies that it accepts URLs, the workflow will show up in the Share sheet for that browser. So here we’ll build a bare-bones workflow here that will send the title, URL, and current selection to a recipient using Messages.

First, open a new workflow in the Shortcuts editor, and make it available to the Share Sheet (see How to add a Shortcuts workflow to a browser's Share Sheet). Ensure that the only accepted input is URLs.

We know that when you use the Share button, you want to share the contents of the active tab. What we don’t know is which browser triggered the workflow, though. So let’s add a Get Details of Browser Tab action, and set it to return the active tab of the the front window of the frontmost browser.

Using that result, we compile the message that we want in a built-in Text action:

Check out this website:

> (Current Selection)

(Page Title)
(Page URL)

Insert the variables by right-clicking, Insert VariableDetails of Browser Tab. Then, click the newly inserted variable, which brings up a panel showing the object’s properties, and pick “Current Selection”, “Page Title”, and “Page URL”, respectively.

Finally, add a built-in Send Message action, and use the result of the previous Text action for the “Message” parameter.

The whole workflow should look like this:

And here’s the workflow for download:

Send message with title, URL, selection.shortcut (22.4 KB)

Hi,
Nice solution to the request. But I never understood why shortcuts are not first class citizens in the Share Sheet on MacOS. Because they are not, I always prefer to pin my shortcuts to the menu bar. As Daron asked for easy access, I would recommend just using this option, it really does give access to the shortcuts and it also works in Safari. With “Browser Action” I only asked for the frontmost browser, so the risk of not getting a URL is relatively low ;-).

Here is an example to get the Amazon price history for a product provided by camelcamelcamel:

It is even easier to start a shortcut by assigning a keyboard shortcut to it. But I’m old and can no longer remember them :wink:

– Leif

1 Like

Thanks for all the info guys. It is annoying though that the standard ‘Share’ menu in Brave does not support the extension / shortcut properly:


I have therefore followed the suggestion from @leif to add it to the menu bar. Works well enough!
I may see if I can update the shortcut to allow me to include a bit of typed text so that I can replace the ‘Check out this website’ with that info.

1 Like