? View this page in our documentation

 

The GoNative JavaScript Bridge is an API embedded in your app that allows your website to communicate with your app. Using the JavaScript Bridge you can dynamically control and configure your app, and access the mobile device native functionality and hardware.

 

GoNative Protocol

GoNative JavaScript Bridge commands are called using the gonative:// protocol handler. For simple commands you may use a standard html anchor element:

<a href="gonative://module/command?parameter=true">Run JavaScript Bridge Function</a>

For more complex commands you can use JavaScript:

if(navigator.userAgent.indexOf('gonative') > -1) {
  var json = JSON.stringify({
      active: true,
      titles: [{
        title: 'my title',
        regex: '.*'
     }]
  });
  window.location.href = 'gonative://navigationTitles/set?persist=true&data=' + encodeURIComponent(json);
}
 

Chaining Multiple Commands

Multiple simultaneous calls to the GoNative JavaScript Bridge via your website JavaScript code will result in only the last command being executed. A simple solution is to include a 500ms delay between calls. However, our recommended solution is to use the gonative://nativebridge/multi command to chain multiple commands together.

var urls = ['gonative://firstcommand/...', 'gonative://secondcommand/...'];
var json = JSON.stringify({urls: urls});
window.location.href = 'gonative://nativebridge/multi?data=' + encodeURIComponent(json);