How to: Trigger the Native Share Dialog

Posted on 31. August 2025 by Jan Bunk


Android and iOS offer a native share dialog for text, files and more. If you want to use it in your app, you can trigger the share dialog through JavaScript.

Here's how the share dialog looks on Android:

A screenshot of the native Android share dialog with the text

And this is the iOS share dialog:

A screenshot of the native iOS share dialog with the text

Using the JavaScript Function

You might want to check out the executeWhenAppReady() function of our app helper script. It ensures that your website doesn't try to interact with the app before it's ready or when your website is loaded using a regular browser (ReferenceError, function is not defined).

shareText

Use this function to trigger the native share dialog to share a string of your choice.


<script>
    try {
        // returns a list of objects representing the menu items
        shareText("Check out this awesome website: https://webtoapp.design/");
    }
    catch (e) {
        // Can occur if:
        // - the app couldn't connect to the native code. Should be very unlikely.
        console.log(e);
    }
</script>
    

Modifying the App Menu

Here's a list of related developer documentation about dynamically changing the app's menu. Make sure you're viewing the one applicable to your app's layout.