Share links, text, and files from your OutSystems app straight to the device's native share sheet — the same picker users already know from their phone and desktop (messages, email, WhatsApp, Teams, Nearby Sharing, and more). Includes a drop-in share button with an automatic copy-link fallback for browsers that don't support sharing.
Platform: OutSystems 11 (O11) · Type: Reactive Web · Curation target: Community
NativeShare wraps the browser's native Web Share API. Instead of building your own "share to X / Y / Z" menu, you hand the OS a title, text, URL, or file, and it shows the user's real share targets. It's zero-setup, needs no accounts or keys, and feels native.
NativeShare
The package includes:
Share
ShareFiles
ShareButton
The share button on a screen:
Tapping it opens the operating system's native share sheet, pre-filled with the title and URL you passed — the user then picks any installed target:
.oap
The browser only allows sharing in direct response to a user action (a "user gesture"). In practice this means:
Call Share / ShareFiles directly from a button's On Click, with no server action in between.
If you run a server action (or any other server round-trip) before the share call, the browser treats the user gesture as spent and blocks the share. Keep the flow client-side: click → share. For files, the file must already be selected in an Upload widget on the client at click time.
Simplest — the button block. Drop the ShareButton block on a screen and set its inputs:
ShareButton Title = "Check this out" Text = "Thought you'd find this useful" URL = "https://www.outsystems.com"
Tap it and the native share sheet appears (as shown above). On an unsupported browser, it copies the link instead and raises OnFallbackUsed.
OnFallbackUsed
Manual — the action. From your own button's On Click, call Share(Title, Text, URL).
Share(Title, Text, URL)
Title
Text
URL
Supported
False
UploadId
MyUpload.Id
CanShareThis
ButtonLabel
"Share"
EnableFallback
True
OnShared
Support is strongest on mobile (Android and iOS) and also works on desktop Safari and Edge (the screenshot above is the Edge/Windows share sheet); Chrome's desktop support is partial and Firefox on desktop doesn't offer it. Because of this spread, NativeShare always feature-detects and the ShareButton degrades to copying the link when native sharing isn't available. If you use the raw Share / ShareFiles actions directly, check the Supported output and provide your own fallback (copy link, or a mailto: link).
mailto:
The API also requires HTTPS — it won't run on an insecure origin.
To share a file, add an Upload widget to your screen and let the user select a file. Pass that widget's Id to ShareFiles (or to the ShareButton block's UploadId input). NativeShare reads the selected file directly from the browser and validates it with canShare first, reporting CanShareThis = False if the browser won't accept that file (unsupported type, or nothing selected) so you can fall back to a download link.
canShare
CanShareThis = False
Commonly shareable types include images, PDFs, text, audio, and video; support varies by browser and OS. Keep the gesture rule in mind: the file must be selected before the user taps, so the share fires synchronously.
Nothing happens on click.Confirm HTTPS, and that the share call runs directly from On Click with no server action before it. Check the browser actually supports the API (see section 7).
It works on my phone but not my desktop browser.Expected — desktop support is uneven. The fallback should be copying the link; make sure EnableFallback is on.
File sharing does nothing.Check CanShareThis — the browser may not support that file type, or no file is selected in the Upload widget. Also confirm the file is chosen before the tap.
I want to know if the user actually shared.The API doesn't expose the chosen target or guarantee completion details; treat sharing as fire-and-forget.
Published on the OutSystems Forge as open, reusable code. Free to use and adapt in your OutSystems projects.