nativeshare
Reactive icon

NativeShare

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 1 Jul (11 hours ago)
 by 
0.0
 (0 ratings)
nativeshare

NativeShare

Documentation
1.0.0

NativeShare

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 


1. Overview

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.

The package includes:

  • A Share client action for title/text/URL.
  • A ShareFiles client action for sharing files selected in an Upload widget.
  • A ShareButton block that renders a button, detects support, and falls back to copy-link automatically.

See it in action

The share button on a screen:

The Share It button on an OutSystems 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:

The native share sheet showing the shared title and URL with share targets like WhatsApp, Teams, Outlook, and Gmail

Key features

  • Native OS share sheet for links, text, and files.
  • Drop-in share button with built-in fallback.
  • Automatic feature detection and graceful degradation.
  • No dependencies, no keys, no server code.

2. Compatibility

ItemRequirement
OutSystems versionOutSystems 11 (O11)
App typeReactive Web
ConnectionHTTPS (required by the browser API)
Best experienceMobile browsers; also desktop Safari and Edge

3. Installation

  1. On the Forge listing for NativeShare, click Install (or install the .oap via Service Center).
  2. Open Service Studio, open Manage Dependencies, and select the NativeShare module.
  3. Check the ShareButton block and/or the Share and ShareFiles actions.
  4. Click Apply and publish.

4. The one rule you must follow

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.


5. Quick start

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.

Manual — the action. From your own button's On Click, call Share(Title, Text, URL).


6. Reference

Share action

InputTypeDescription
TitleTextOptional heading for the shared content; used as the subject/headline by many share targets.
TextTextOptional body text to share; used as the message body by most targets.
URLTextOptional link to share; the most broadly supported field. At least one of Title, Text, or URL must be provided.
OutputTypeDescription
SupportedBooleanFalse if the browser has no Web Share API — branch to your fallback.

ShareFiles action

InputTypeDescription
UploadIdTextThe client-side Id of the Upload widget holding the file(s), e.g. MyUpload.Id. The file must already be selected on the client.
TitleTextOptional heading to accompany the shared file(s).
TextTextOptional message to accompany the shared file(s).
OutputTypeDescription
SupportedBooleanFalse if file sharing isn't available in this browser.
CanShareThisBooleanFalse if the browser can't share this specific file (unsupported type, or no file selected).

ShareButton block

InputTypeDefaultDescription
TitleTextOptional heading for the shared content.
TextTextOptional body text to accompany the share.
URLTextOptional link to share. At least one of Title, Text, or URL should be set.
UploadIdTextOptional. The Id of an Upload widget (e.g. MyUpload.Id) when sharing a file. Leave empty for link/text sharing.
ButtonLabelText"Share"Button caption.
EnableFallbackBooleanTrueCopy the link to the clipboard when native sharing isn't available.
EventWhen it fires
OnSharedThe native share was invoked.
OnFallbackUsedThe fallback (copy link) ran instead.

7. Browser support and fallback

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).

The API also requires HTTPS — it won't run on an insecure origin.


8. Sharing files

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.

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.


9. Notes on behaviour

  • User cancels the share sheet: this is normal and is not treated as an error — no failure event is raised.
  • Which app the user picked: by design, the API never tells your app which target the user chose (or which targets exist), to protect user privacy. So you can't track "shared to WhatsApp" from this API.
  • Canonical URLs: if a page has multiple URLs, prefer sharing its canonical URL for a cleaner recipient experience.

10. Troubleshooting / FAQ

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.


11. Best practices

  • Prefer the ShareButton block — it handles detection and fallback for you.
  • Always share a clean, canonical, absolute URL.
  • Keep the share call client-side and gesture-driven.
  • Provide a sensible fallback so desktop and Firefox users aren't left without an option.
  • Test on a real phone; that's where the share sheet shines.

12. Version history

VersionNotes
1.0.0Initial release. Share and ShareFiles actions; ShareButton block with feature detection and copy-link fallback; file sharing via an Upload widget with type validation.

13. License

Published on the OutSystems Forge as open, reusable code. Free to use and adapt in your OutSystems projects.