PhoneGap的Andr​​oid的:如何在新的浏览器窗口中打开列入白名单域名的网址?浏览器、名单、网址、域名

2023-09-06 10:30:48 作者:咖啡不解酒的醉

我开发的iOS和放大器; Android应用程序与科尔多瓦1.9 + JQM。

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

在应用程序中的www.mydomain.com从JSON服务中读取数据,所以我有这个域名白名单中cordova.xml

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

现在的问题是我需要在一个新的浏览器窗口中打开某些URL指向www.mydomain.com,应用程序之外。

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

我想theese:

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

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

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

......但所有这些web视图里面打开新窗口,而不是在本地的浏览器新窗口。我在内部监督办公室这项工作,但无法看到Android的解决方案。

...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.

任何帮助将是AP preciated。谢谢!

Any help would be appreciated. thanks!!

推荐答案

有两种方法可以做到这一点:

There are two ways to do this:

使用navigator.app.loadUrl(http://www.mydomain.com/index.html,{openExternal:真}); 使用ChildBrowser插件和它的openExternal命令。 Use "navigator.app.loadUrl("http://www.mydomain.com/index.html", {openExternal: true}); Use the ChildBrowser Plugin and it's openExternal command.