In your GoodBarber HTML5 plugin, you can use "basic" methods, allowing interactions with the user's device.

These methods are also available in the Basic Custom sections.

Most of the basic methods can be called by launching a navigation to a standard URL scheme. They're also available, in an easier way, in the GoodBarber JavaScript ToolKit.


1

Web Browser Navigation (https://)

If you want to start a navigation to an external URL - typically a web link-  you can just call the link.

The https:// prefix will be interpreted by the app to be opened in the internal browser.

Example of a link to Google within a plugin:
<a href="https://www.google.com">Go on Google</a>


2

Internal App Navigation

If you want to navigate through your GoodBarber application - typically open another page of the app -  you can just call the link.

The link will be interpreted as an internal link, so the app, instead of opening the web browser, will handle internally the navigation to the targeted page.

Example of a link to a page of the app within a plugin:
<a href="https://www.myappdomain.com/mypageslug">Open the news section of the app</a>


3

Mail Composer (mailto:)

Il you want to open the phone's Mail app composer, to allow your users to send an e-mail from your plugin, you just have to launch a navigation towards a mailto: scheme.

According to the standard , a mailto: link can handle several parameters (to address, subject, body, etc.).

Example of mailto: link within a plugin:
<a href="mailto:contact@goodbarber.com?subject=Hello&body=GoodBarber">Send an e-mail</a>


4

Call (tel:)

If you want to start a phone call within your plugin, you can use the URL prefix tel:.

Warning: There are no alert before the phone call starts using the tel: method. If you want to ask your user for a confirmation, you'll need to implement a confirmation alert.

Example of phone call within a plugin:
<a href="tel:+1(555)555-5555">Call +1 (555) 555-5555</a>


5

SMS Composer (sms:)

If you want to open the phone's SMS composer within your plugin, you can use the URL prefix sms:.

It is unfornately impossible to set the SMS body, but you can set a default recipient.

Example of SMS within a plugin:
<a href="sms:+1(555)555-5555">Text +1 (555) 555-5555</a>


6

The maps method allows to open directly the Maps native app on the user's device, with one or several parameters.

The parameters to include into the URL are the one which usually follow URLs like "http://maps.google.com" and "http://maps.apple.com". You can find more information about these parameters in the Apple reference documentation .

The maps method allows you to send seamlessly the user to the dedicated native app of his device (Maps on iOS, Google Maps on Android). If you want to send your users to a specific app (without the automatic choice), you can directly make a link to the destination URL that will be opened into the in-app browser. 

Example of the maps method usage:
<a href="goodbarber://maps?q=cupertino">Locate "Cupertino"</a>


7

Method : openExternal (Open an URL in the external browser)

The openExternal method allows you to open the phone's browser (and leave the app).

URL parameters:
url : the URL to open

Example of the openexternal method usage: 
<a href="goodbarber://openExternal?url=http%3A%2F%2Fwww.twitter.com">Open this link in the external browser</a>


More articles