0

I have a problem with testing our app on iOS on Android everything is working as expected, but i cant figure out why the iOS version isn't working.

I want the in appbrowser opens when openBrowser is triggered and the appbrowser closes when the closeBrowser is triggered. (this works in android, not in ios)

This are the above mentioned functions

openBrowser() {
    this.ref = cordova.InAppBrowser.open('someurl', '_blank','location=no')
}

closeBrowser(){
  this.ref.close();
}

So basically the problem that when the function openBrowser is triggered, it doesnt just open. When I press the iphone home button twice(that's how you can switch between apps that are already open) suddenly the inappbrowser opens. Same goes for the close function.

This is one of the weirdest thing I've seen so far..

Any clues on why that might happen?

Thanks in advance.

Roy Stijsiger
  • 199
  • 2
  • 12
  • Do you have the InAppBrowser package enabled in the `config.xml` and `cordova_plugins.js` files? – Andreas Furster Apr 06 '18 at 12:55
  • @AndreasFurster yes, it ended up the device.ready not being called on iOs solved this issue by adding gap://* to the CSP in the index.html see my answer for an example. – Roy Stijsiger Apr 06 '18 at 13:01

1 Answers1

1

It ended up being the Content Security Policy in the index.html file.

For the device ready to be fired you actually need to add gap:// to your default-src array in the

Found my answer here: Cordova deviceready not firing in iOS until interacting with iOS

Roy Stijsiger
  • 199
  • 2
  • 12