2013-07-31 109 views
1

我正在开发一个PhoneGap应用程序,并且我遇到了一些问题。如何在PhoneGap上的InApp浏览器内部的默认浏览器中打开链接

在PhoneGap的应用程序里面我打开本地链路与InAppBrowser

window.open('example.html', '_blank', 'location=no'); 

当我在example.html的网页是我不能做任何事情与PhoneGap的,因为是喜欢它是默认浏览器内的应用程序。

所以,我的问题是,我要开在example.html的默认浏览器的链接,但因为我不是在应用程序中,并没有我不能使用InAppbrowser的声明_system运行phonegap命令。

的Index.html

window.open('example.html', '_blank', 'location=no'); // Open in InApp 

example.html的

link2 => www.google.es -> I want to open in default browser. 

非常感谢你,如果你能帮助我。

+0

嗨,你有解决方案吗? – rkaartikeyan

回答

0

我一直用这个作为一种解决办法(打开一个inappbrowser实例):

// Image zoom 
$('#container').on('tap', '#content.cmscontent img', function() { 
    var browser = window.open((navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') + encodeURI($(this).attr('src')), '_blank', 'location=no,toolbar=yes,enableViewportScale=yes,transitionstyle=crossdissolve'); 
}); 

见我加(navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '')作为URL前的前缀。现在,它会检测您的应用程序在Android上,并在其前面添加本地网址。

+0

其实他问了一些不同的东西。 1. index.html,他编码在inAppBrowser中打开inappbrowser-index.html(var ref = window.open('inappbrowser-index.html','_blank','location = no');现在当他运行项目在设备上打开inAppBrowser中的inappbrowser-index.html,所以没有问题,但在inappbrowser-index.html中,他有谷歌链接,所以当他点击链接时,它也在同一个InAppBrowser中打开。所以他不需要这个,而是希望谷歌链接应该在Native Browser中打开。 – rkaartikeyan

相关问题