gpt4 book ai didi

javascript - Phonegap 应用程序无法打开外部链接

转载 作者:行者123 更新时间:2023-11-28 08:32:16 25 4
gpt4 key购买 nike

问题已解决。直到我需要在我的 html 中添加一个到 Cordova 的脚本链接

我知道该事件正在触发,因为当我单击按钮时,我的服务器显示了对链接的请求。它与我的电脑和平板电脑上的 Chrome 连接良好,但 native 应用程序按钮不会为我打开系统浏览器。

该链接连接到一个 .apk 下载,当我按下按钮时,服务器正在按请求注册该下载,因此事件处理不是问题。我也尝试过使用“_blank”代替系统,但仍然没有乐趣

任何帮助将不胜感激

编辑:还按照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>

最佳答案

确保 html 文件中有指向 cordova 脚本的链接。无需自己加载文件,因为phonegapp 会构建它。

关于javascript - Phonegap 应用程序无法打开外部链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21698958/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com