|
| 1 | +--- |
| 2 | +slug: launch-url |
| 3 | +title: Launch URL [Action] |
| 4 | +tags: [] |
| 5 | +description: Learn how to use the Launch URL Action in FlutterFlow to open URLs with supporting apps. |
| 6 | +sidebar_position: 7 |
| 7 | +--- |
| 8 | + |
| 9 | +The Launch URL Action lets you specify a URL that will be opened using an app supporting it. If there is more than one app that can handle the specified URL, the user will be presented with a dialog from where one of the apps can be selected. |
| 10 | + |
| 11 | +## Adding Launch URL Action |
| 12 | + |
| 13 | +Follow the steps below to add this action to any widget. |
| 14 | + |
| 15 | +1. Select the **Widget** (e.g., Container, Button, etc.) on which you want to add the action. |
| 16 | +2. Select **Actions** from the Properties panel (the right menu), and click **Open**. This will open an **Action Flow Editor** in a new popup window. |
| 17 | +3. Click on the **+ Add Action**. |
| 18 | +4. On the right side, search and select the **Launch URL** (under widget/UI Interactions) action. |
| 19 | +5. In the *URL Value Type* property, select either **Specify URL** (to add the URL as a String) or **From Variable** (to use the value stored in a String variable). |
| 20 | +6. If using **Specify URL**, enter the URL that you want to use in the **URL** field. For example, you can enter "[https://flutter.dev](https://flutter.dev/)" to open the Flutter webpage. |
| 21 | +7. If using **From Variable**, select the **Source** from which to fetch the URL value. You can also specify a **Default Value** that will be used when the variable value is not set (i.e. null). |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## URL schemes |
| 28 | + |
| 29 | +The following are some common URL schemes that can be handled by an external app present on the user's device. |
| 30 | + |
| 31 | +### Open a webpage |
| 32 | + |
| 33 | +This URL scheme for loading up a webpage can be defined in this format: |
| 34 | + |
| 35 | +#### Scheme |
| 36 | + |
| 37 | +`http:<webpage URL link>` |
| 38 | + |
| 39 | +`https:<webpage URL link>` |
| 40 | + |
| 41 | +#### Example |
| 42 | + |
| 43 | +`https://flutter.dev` |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +### Use a phone number |
| 48 | + |
| 49 | +This URL scheme helps to handle phone numbers inside your app. Using this, you can easily initiate a phone call to the provided phone number from the user's device. |
| 50 | + |
| 51 | +#### Scheme |
| 52 | + |
| 53 | +`tel:<phone-number>` |
| 54 | + |
| 55 | +#### Example |
| 56 | + |
| 57 | +`tel:2125551212` |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +### Compose a text message |
| 62 | + |
| 63 | +This URL scheme lets you redirect users from your app to compose and send an SMS message to a specified phone number. |
| 64 | + |
| 65 | +#### Scheme |
| 66 | + |
| 67 | +`sms:<phone_number>` |
| 68 | + |
| 69 | +#### Example |
| 70 | + |
| 71 | +`sms:2125551212` |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +### Create an email |
| 76 | + |
| 77 | +This URL scheme helps you to launch an email app on the user's device. It allows you to pass the *email to*, *subject*, and *body* to the app so that you have these fields prefilled with details as the email app is opened. |
| 78 | + |
| 79 | +#### Scheme |
| 80 | + |
| 81 | +`mailto:<email_address>?subject=<subject>&body=<body>` |
| 82 | + |
| 83 | +#### Example |
| 84 | + |
| 85 | +`mailto:[email protected]?subject=Welcome%20to%20FlutterFlow&body=Hey%20there` |
| 86 | + |
| 87 | +This will pass the following details to the email app: |
| 88 | + |
| 89 | +***mailto: *** [email protected], ***subject: *** Welcome to FlutterFlow, ***body: *** Hey there |
| 90 | + |
| 91 | + |
0 commit comments