OGeek|极客世界-中国程序员成长平台

标题: android - Cordova :为内容 src 打开的外部浏览器 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-9 06:20
标题: android - Cordova :为内容 src 打开的外部浏览器

我正在构建一个非常简单的 cordova 应用程序来做一件事:用 webview 打开一个 web url。

所以我在config.xml

中做了如下改动
<content src="http://www.whatever.com">

它在 iOS 模拟器上运行良好。然后我尝试使用 build.phonegap.com 进行构建。在我的手机上安装了生成的 APK。但是在运行应用程序时,它要求我立即选择一个外部浏览器。

出了什么问题?



Best Answer-推荐答案


我玩了一些,至少对于 google,将以下内容添加到 access-origin 有帮助:

<access origin="*" launch-external="no"/>

也许这对你有帮助,但是,我自己的网站仍然存在问题

编辑另外,这些也解决了我的问题:

<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" launch-external="no"/>
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />

(当我使用命令行“cordova create”时,自动为我安装了白名单插件)

关于android - Cordova :为内容 src 打开的外部浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34893505/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://www.ogeek.cn/) Powered by Discuz! X3.4