【发布时间】:2014-02-11 10:16:47
【问题描述】:
问题已解决。我需要在我的 html 中添加一个指向 Cordova 的脚本链接
我知道事件正在触发,因为当我单击按钮时,我的服务器会显示对链接的请求。它与我的电脑和平板电脑上的 chrome 连接良好,但本机应用程序按钮不会为我打开系统浏览器。
该链接连接到 .apk 下载,当我按下按钮时,服务器正在按请求注册该下载,因此事件处理不是问题 afaik。我也试过 '_blank' 而不是 system 但仍然没有乐趣
任何帮助将不胜感激
编辑:还按照here 尝试了navigator.app.loadUrl
编辑编辑:嗯,我尝试在函数的第一行插入一个 'alert("test");' 语句,但没有触发......但目标链接的服务器正在注册请求。
相关补丁代码在这里:
Server.getUpdateInfo(getDevice()?getDevice():"Android", function (data) {
if(data.IsUpdate){
if(getDevice()){
$("#btnInstall").on("click", function(){
window.open($(this).data("url"),'_system');
});
}
else {
$("#btnInstall").closest(".ui-btn").hide();
}
}
});
这是我的 config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android"
id = "com.blahblahblah"
version = "1.0.4">
<name>Server App</name>
<description>
jQuery Mobile interface for Server Admin
</description>
<author>
Firma GmbH
</author>
<access origin="*"/>
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
<preference name="phonegap-version" value="3.1.0" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<preference name="auto-hide-splash-screen" value="true" />
<plugin name="Notification" value="org.apache.cordova.Notification"/>
<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager" />
<plugin name="NetworkStatus" value="CDVConnection" />
</widget>
【问题讨论】:
-
使用inAppBrowser在浏览器中打开链接
-
@NijilNair "我也试过用 '_blank' 代替系统,但仍然没有乐趣"
-
您应该为自己的问题添加答案并接受它,这样问题才会结束:)
-
@MysticMagic 可以,谢谢
标签: javascript android jquery jquery-mobile cordova