Вопрос

I am developing a iOs & Android App with Cordova 1.9 + JQM.

The app reads data from JSON services in "www.example.com", so I have this domain whitelisted in cordova.xml

The problem is I need to open some URL pointing to www.example.com in a new browser window, outside the app.

I tried these:

<a href="#" onclick="navigator.app.loadUrl('http://www.example.com/external')"
   class="ui-link" rel="external" target="_blank">external</a>

<a href="#" onclick="window.open('http://www.example.com/externa')"
   class="ui-link" rel="external" target="_blank">external</a>

<a href="http://www.example.com/external"
   class="ui-link" rel="external" target="_blank">external</a>

...but all of them open the new window inside the webView, not in a native browser new window. I made this work in iOS but can't see the solution for Android.

Any help would be appreciated. thanks!!

Это было полезно?

Решение

There are two ways to do this:

  1. Use navigator.app.loadUrl("http://www.example.com/index.html", {openExternal: true});
  2. Use the ChildBrowser Plugin and it's openExternal command.
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top