1
votes

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
I've removed Content-Security-Policy tag from index.html and that started to work as expected! There was a default tag from "Hello World" example that caused mentioned problem. Thank you, jcesarmobile for the hint. - Mambas

1 Answers

2
votes

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