GoNative

The GoNative Developer Hub

Welcome to the GoNative developer hub. You'll find comprehensive guides and documentation to help you start working with GoNative as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Detecting App Usage

You may choose to serve a different version of your website through your app. You can then control when the JavaScript Bridge commands are available, and also provide different layouts in the app versus the browser, e.g. limit the pages that are linked and accessible within the app, remove your website navigation menus in favor of a native navigation menu, remove a website footer to improve the app UI, etc.

To detect when your website is showing through your app:

  1. Use a different URL for your app (e.g. https://app.yoursite.com)
  2. Detect the GoNative user agent header at your server or load balancer (e.g. Express)
  3. Detect the GoNative user agent in your website JavaScript (e.g. navigator.userAgent)

Your app will append the following strings to the end of the device default user agent:
iOS app: GoNativeIOS/1.0 gonative
Android app: GoNativeAndroid/1.0 gonative

app.get('/', (req, res) => {
  if(req.header('User-Agent').indexOf('gonative') > -1)
    res.send('App version of website')
  else
    res.send('Browser version of website')
})
if (navigator.userAgent.indexOf('gonative') > -1) {
  window.location.href = 'gonative://module/command?parameter=true';
}

Updated 2 months ago


Next Steps

App Testing

Detecting App Usage


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.