standard.launchURL
Opens a URL with the default URL handler of the front-end.
Syntax
ui.Interface.frontCall("standard", "launchURL",
[ url [
, mode ]
], [] )
- url - The URL / URI to invoke.
- mode (optional) - This parameter is ignored by GMA/GMI/GDC. With GAS, 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 a 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).
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.
It is possible to produce a 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 GAS/GBC, when the mode parameter is set to
"
replace
", the new URL will be launched in the current browser tab used by application windows, instead of launching the specified URL a new browser tab. - With GMA, GMI and GDC front-ends, the mode parameter is ignored.
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"], [])