【发布时间】:2016-04-12 22:54:23
【问题描述】:
我正在使用 Cordova InAppBrowser 开发一个简单的 Phonegap 应用程序。我正在我的 Android 设备上进行测试。
在 config.xml 我得到了下面的代码
....
<preference name="phonegap-version" value="cli-5.2.0" />
.....
<plugin name="cordova-plugin-whitelist" source="npm" />
<plugin name="org.apache.cordova.inappbrowser" source="pgb" />
.....
<access origin="*"/>
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
....
在 Javascript 中,单击按钮时我得到以下代码
....
var ref = cordova.InAppBrowser.open('http://google.com', '_blank', 'location=yes','fullscreen=no');
....
index.html
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=medium-dpi" />
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src * 'self' data:">
我使用 Phonegap 桌面应用程序进行测试。当触摸按钮时,浏览器窗口打开,我可以看到谷歌。
但是当我通过http://build.phonegap.com 构建相同并安装在我的设备上时。触摸按钮后什么都没有打开。这里出了点问题。
对我来说看起来很奇怪。任何帮助表示赞赏。
【问题讨论】:
-
尝试运行 adb chrome 插件,实时检查视图,检查控制台消息,看看可能出了什么问题。 chrome.google.com/webstore/detail/adb/…
-
@mani 我以前从没用过这个。我应该下载 Android Studio 和工具来使用 chrome adb 插件吗?
-
你可能不需要下载android studio,但是可以下载android工具(adb),在你的设备上启用开发者模式。以这种方式进行调试可能会为您指明正确的方向。
-
您能否发布您的 index.html 或至少它的头部部分,您可能有内容安全策略问题?
标签: javascript android cordova phonegap-build