![](/img/trans.png)
[英]using build.phonegap.com - how to reference cordova.js on pages other than index.html?
[英]Cordova InAppBrowser not working via build.phonegap.com
我正在使用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 Desktop App進行測試。 通過觸摸按鈕,瀏覽器窗口打開,我可以看到google了。
但是,當我通過http://build.phonegap.com構建相同文件並安裝在我的設備上時。 觸摸按鈕后,什么都沒有打開。 這里出問題了。
對我來說看起來很奇怪。 任何幫助表示贊賞。
我在Adobe論壇上發布了相同的問題,並為我的問題找到了解決方案。
https://forums.adobe.com/thread/2138992
更改以下內容后,它開始工作
<plugin name="org.apache.cordova.inappbrowser" source="pgb" />
至
<plugin name="cordova-plugin-inappbrowser" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.