launchURL

Opens an URL with the default URL handler of the front-end.

Syntax

ui.Interface.frontCall("standard", "launchURL",
  [ url [, mode ] ], [] )
  1. url - The URL / URI to invoke.
  2. mode (optional) - This parameter is ignored by GMA/GMI/GDC. With GBC, by default, a new browser window/tab is opened. Use "replace" mode, to reuse the current web browser window/tab for the specified URL.

Usage

The "launchURL" front call opens an URL with the default URL handler available on the front-end platform. This is typically the web browser for "HTTP:" URLs, or the mailer for "mailto:" URLs, but the corresponding application may also be dedicated to the type of object specified by the URL (for example, a mapping service or to initiate a phone call).

Important: Some types of URLs are not supported by all front-end platforms. Make sure that you test all target front-ends when using a launchURL front call. For example, when the GBC front-end is running from HTTP/HTTPS (through the GAS), the web browser will block file://host/path URIs from opening, as this would create a security hole.

This front call is a powerful feature: front-end applications can register themselves as URL handlers, so you can start applications on the front-end through the launchURL front call.

Supported schemes depend on your system configuration.

Tip: It is possible to produce an URI with the ui.Interface.filenameToURI() method, from the file located on the application server. This URI can then be used with the launchURL front call for example, to show PDF files.

The mode parameter is optional and is interpreted differently depending on the front-end type:

  • With the Genero Browser Client (GBC), use "replace" for the mode parameter, if you want the current application in the browser window or tab to be replaced with the new URL, instead of launching a new browser window or tab. If it is not present, or if a value other than "replace" is specified, the Genero Browser Client behaves like the Genero Desktop Client, opening the URL in a new browser window.
  • With Genero Mobile for Android (GMA), Genero Mobile for iOS (GMI), and Genero Desktop Client (GDC) front-ends, the mode parameter is ignored if specified.

Example

To invoke Google Play Store:

CALL ui.Interface.frontCall("standard", "launchURL",
 ["market://details?id=com.google.android.apps.currents"], [])
CALL ui.Interface.frontCall("standard", "launchURL",
 ["market://details?id=com.google.zxing.client.android"], [])

To open Google Maps:

CALL ui.Interface.frontCall("standard", "launchURL",
 ["geo:48.613363,7.711083?z=17"], [])

To open Google Street View:

CALL ui.Interface.frontCall("standard", "launchURL",
 ["google.streetview:cbll=48.613363,7.711083&cbp=1,0,,0,1.0&mz=17"], [])

To initiate a phone call:

CALL ui.Interface.frontCall("standard", "launchURL", ["tel:+336717623"], [])