Opening External Links / Apps from JavaScript
Overview
External links can be triggered from JavaScript (which can also be used to open external apps), and some other actions can also be triggered such as making a phone call or drafting an SMS to a specified recipient.
The following syntax should be used in a JavaScript function (that is called when a button is pressed, for example):
Opening an External App
By utilizing URL handlers that are available on a mobile device, it is possible to launch external apps.
In the following example, we open the App Store on iOS and display the JourneyApps application, using the itms://
URL handler that is available on iOS.
View XML:
View JavaScript:
Platform-Specific Links
In some cases, it may be necessary to tailor your links depending on which mobile OS the user is using (iOS or Android). For this purpose, the global journey.platform
property can be used, which will have a value of either "iOS" or "Android", or "Web" (for Chrome) depending on the OS.
To make our previous example work on both Android and iOS, we would use: