Internal vs External Links

📘

Define rules to control which links open within your app versus the device's default browser (Mobile Safari/Chrome/etc). Rules are applied in order from top to bottom.

Overview

Use this configuration to specify which URLs should be loaded internally within your app, and which should launch the user out of the app and open in their default mobile browser.

For example, you may want to have pages from a vendor hosted website used by your users to open within your app. While you may want pages on third party external sites to open in the user's mobile browser.

Configuration

Our default configuration for internal/external links works well for most clients. You may modify this set of rules as needed.

Regex matches are prioritized top to bottom, so it's best to position the most specific rules first, and the most general rules last.

Editing a Rule

  • To edit a rule, click the Edit icon on the right corner of the rule.

  • To apply a rule for a single page, select "Single Page", then add the URL of the page in the provided field.

  • To apply a rule for Multiple pages, select "Multiple Pages", then add the URL Path in the provided field.

  • To apply a rule for All pages, select "All Pages", and the regex will automatically be applied in the rule.

  • To apply a custom regex to your rule, select "Custom", then add the regex in the provided field.

  • If you want to apply a rule in your subdomains as well, toggle the "Include Subdomains" option.

To match specific links to any arbitrary domain you may add a regular expression that looks for a parameter to be defined at the end of the link. e.g. define the rule https?:\/\/.*\?external=true to open externally and add links to your site as follows https://anysite.com/page?external=true

Regular expression testers

Changing rules during runtime

↔️GoNative JavaScript Bridge

Run the following GoNative JavaScript Bridge command to apply new internal/external rules:

var rulesArray = [
 {
   "id": 1,
   "regex": "https?://maps\\.google\\.com.*",
   "internal": false
 },
 {
   "id": 2,
   "regex": "https?://([-\\w]+\\.)*linkedin\\.com/.*",
   "internal": false
 },
 {
   "id": 3,
   "regex": "https?://([-\\w]+\\.)*google\\.com/maps/search/.*",
   "internal": false
 }
];

gonative.internalExternal.set({"rules": rulesArray});