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.
Web Browser Navigation (http://)
If you want to start a navigation to an external URL - typically a web link- you can just call the link.
The http:// 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="http://www.google.com">Go on Google</a>
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:firstname.lastname@example.org?subject=Hello&body=GoodBarber">Send an e-mail</a>
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>
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>
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>
Method : openapp (Open an app, or a link)
The openapp method allows you to open a custom URL scheme, if an app able to open it is installed on the user's device, and to open a web URL if not.
- scheme : the custom URL scheme of the app to be opened (has to be url encoded)
- url : the URL to open if the device can't handle the URL scheme
Example of the openapp method usage:
<a href="goodbarber://openapp?scheme=twitter%3A%2F%2F&url=http%3A%2F%2Fwww.twitter.com">Open the Twitter app if it's installed, or go to the website otherwise</a>
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 : 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>
Method : gotosection (Go to a section)
The gotosection method allows you to make a link to another page of your app.
- id : the page identifier
NB : To find your pages ids, go to the Developer section of your GoodBarber backend.
Example of the gotosection method usage:
<a href="goodbarber://#!section=123456789">Open the news section of the app</a>
- Altri articoli