title: Cordova Wrapper App Where Internal Links Load In App, External Links Load In Browser
body: <p>I have a simple <a href="https://cordova.apache.org/" rel="nofollow noreferrer">Cordova</a> wrapper app which points to an external webpage, without defining any of its own views.</p>
  
  <p>I would like <em>all internal links from that domain to be loaded inside the app</em>, but <em>all external links (<a href="http://twitter.com" rel="nofollow noreferrer">http://twitter.com</a>, etc) to be loaded in the system browser</em>, so the pages have Back / Forward functionality.</p>
  
  <p>In a normal app with views, I could set <code>target='_system'</code> to load links in the default browser, or use the <a href="https://www.npmjs.com/package/cordova-plugin-inappbrowser" rel="nofollow noreferrer">cordova-plugin-inappbrowser</a> to explicitly open links in a web browser view. Unfortunately in this case I don't have the ability to edit the server side code, so need a solution that works within the app.</p>
  
  <p>If I define the <code>config.xml</code> as such, then both internal and external links are loaded in app.</p>
  
  <pre><code>&lt;content src="http://example.com/" /&gt;
  &lt;access origin="*" /&gt;
  &lt;allow-navigation href="*" /&gt;
  </code></pre>
  
  <p>If I define the <code>config.xml</code> with <code>allow-intent</code>, then internal and external links are opened in the system browser. </p>
  
  <pre><code>&lt;content src="http://example.com/" /&gt;
  &lt;access origin="*" /&gt;
  &lt;allow-navigation href="*" /&gt;
  &lt;allow-intent href="http://*/*" /&gt;
  &lt;allow-intent href="https://*/*" /&gt;
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/29430835/385730">Others</a> have <a href="http://weblog.west-wind.com/posts/2015/Jul/02/External-Links-in-Cordova-for-iOS#HandlingTargetLinks" rel="nofollow noreferrer">suggested</a> using custom javascript to override the <code>target</code> to <code>_system</code>, however since I don't have my own views I can't really do that.</p>
  
  <p>Is it possible to define <code>allow-intent</code> for the <a href="https://github.com/apache/cordova-plugin-whitelist" rel="nofollow noreferrer">cordova-plugin-whitelist</a> in such a way to include <em>all URLs that are not the internal domain</em>?</p>
  
  <p>Or will I need to somehow override <code>shouldStartLoadWithRequest</code> in <code>MainViewController</code> and then call <code>[[UIApplication sharedApplication] openURL:url]</code>? </p>