2014-09-28 74 views
-1

过去几天我一直在学习如何使用PhoneGap,而我面临的问题只有在Android中运行时才会发生。当我在PhoneGap的开发者应用程序中使用“phonegap serve”运行它时,它工作得非常好。PhoneGap外部浏览器问题

的JavaScript

$(document).on("mobileinit", function(){ 

    // Handle link clicks in our own way 
    $(document).find('a').on('click', bind_a_rel_external); 

}); 

function bind_a_rel_external(e){ 

    if($(this).attr('rel') == 'external'){ 

     e.preventDefault(); 

     window.open($(this).attr('href'), '_system'); 

    } 

} 

HTML(注意相对= “外部”)

<a href="https://facebook.com/motostats" rel="external">Like us on Facebook<br><br> 
<img src="assets/img/facebook.png" width="50"></a> 

只是重申;在PhoneGap的开发人员应用程序中工作正常。在原生Android中不起作用。 Inappbrowser插件已经启动。所以我假设它没有正确编译。我没有为iOS创建这个应用程序,所以无法测试它。

在此先感谢。我整个周末都在拉我的头发。

回答

0

在你的config.xml中有一条线说是这样的:

<access origin="127.0.0.1" /> 

尝试改变这

<access origin="*" /> 

,让我知道,如果它的工作原理!

+0

这已经在config.xml中设置 - 是我检查的第一件事情)。 – 2014-10-02 20:56:53