Phonegap build app - inappbrowser window is not shown automatically

谁都会走 提交于 2019-12-08 03:27:51

问题


We need to create a simple iOS App that is wrapper for some existing website (will be used internally, not for Apple Store of course).

We're using Phonegap Build service and built a few successfull apps already. But with this app we have some issue. We want the App opens inappbrowser window when starts, and that's all we need. We include plugin in config.xml:

<plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />

then we have a js code that should open inappbrowser onDeviceReady state:

...
document.addEventListener('deviceready', function(){
 window.open("http://www.website.com/", '_blank','toolbar=no,location=no');
}, false); 
...

So when App is started nothing happens, no matter how long you wait. But if you minimize App and restore (Home button and then open again), you see that window opened fullscreen and site loaded well. So why it is not opened automatically? We trye to assign that function to button click, no success - same behaviour. We tried to change that to cordova.InAppBrowser.open instead and change options to toolbar=yes etc. No success. When you minimize and restore - window shown. On Android that works well - window is opened automatically on App load and you can see website. Any suggestions or help?


回答1:


You have to add gap: in the default-src of your Content-Security-Policy meta tag in your index.html



来源:https://stackoverflow.com/questions/43316548/phonegap-build-app-inappbrowser-window-is-not-shown-automatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!