title: cordova inappbrowser cannot open an external url on iOS
body: <p>I'm developing an hybrid app in phonegap and basically I have a button in the index page which whenever is clicked opens up an external url. I succeed on Android and fail on iOS. </p>
  
  <p><strong>I've looked up these questions <a href="https://stackoverflow.com/questions/21636917/ios-cordova-inappbrowser-not-working">iOS / Cordova: InAppBrowser not working</a> - <a href="https://stackoverflow.com/questions/36829871/cordova-phonegap-onclick-doesnt-work">cordova/phonegap onclick doesn&#39;t work</a> - <a href="https://stackoverflow.com/questions/15534630/phonegap-build-how-to-open-external-url-in-device-browser-on-android">PhoneGap Build: how to open external url in device browser on Android?</a> - <a href="https://stackoverflow.com/questions/17887348/phonegap-open-link-in-browser">phonegap open link in browser</a> but unfortunately none of these questions helped me to fix the issue.</strong></p>
  
  <hr>
  
  <p>First hypothesis could be an error message alert : The error message
  on the iPhone where I'm testing my app is: <code>[ERROR] Error initializing
  Cordova: Missing Command Error</code>.</p>
  
  <p>Second hypothesis I'm doing something wrong with the <code>onclick</code> event of the <code>window.open</code>
  method because when I click the open button on the iOS test device nothing happens.</p>
  
  <p>Here is the code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById("openBrowser").addEventListener("click", function(){
          var ref = window.open('http://www.espn.com', '_self', 'location=yes');
           ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
           ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
           ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
           ref.addEventListener('exit', function(event) { alert(event.type); });
      });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button id="openBrowser"&gt;APRI&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <hr>
  
  <p>As you can see the above piece of code works and works on the google ripple emulator too and as I said earlier at the beginning of my question it works also on Android (link to the android web app <a href="https://play.google.com/store/apps/details?id=com.phonegap.unoxtutti&amp;hl=it" rel="nofollow noreferrer">https://play.google.com/store/apps/details?id=com.phonegap.unoxtutti&amp;hl=it</a>)
  As a matter of fact I'm not sure what problem may be behind this malfunctioning either the former or the latter hypothesis.</p>
  
  <p>Besides the cordova plugin inappbrowser is in config.xml </p>
  
  <pre><code>    &lt;plugin name="org.apache.cordova.inappbrowser" /&gt;
  </code></pre>
  
  <p>I'm really unable to find the bug but I hope to have provided you the necessary information to help me to fix this seemingly insolvable problem</p>
  
  <p>The test environmemts are <a href="http://emulate.phonegap.com/" rel="nofollow noreferrer">Google Ripple Emulator</a>, <a href="http://phonegap.com/blog/2015/03/02/phonegap-app-desktop-0-1-2/" rel="nofollow noreferrer">Phonegap Desktop App</a> and the <a href="http://docs.phonegap.com/getting-started/2-install-mobile-app/" rel="nofollow noreferrer">Phonegap Mobile App</a>. The desktop app creates the directory of the project while the mobile app and the google ripple emulator are connected to the desktop app and are my test environments. Last but not least on the ripple emulator the external url successfully opens up while it doesn't on the mobile app and the <code>initialization error</code> throws when the app is opened.</p>