简体   繁体   English

Cordova InAppBrowser在iOS中不起作用

[英]Cordova InAppBrowser doesnt work in iOS

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. 我在Android上的iOS上测试我们的应用程序时遇到问题,一切都按预期工作,但是我无法弄清为什么iOS版本无法正常工作。

I want the in appbrowser opens when openBrowser is triggered and the appbrowser closes when the closeBrowser is triggered. 我希望在触发openBrowser时打开内置浏览器,并在触发closeBrowser时关闭浏览器。 (this works in android, not in ios) (这适用于android,不适用于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. 所以基本上就是这样的问题,当触发函数openBrowser时,它并不会打开。 When I press the iphone home button twice(that's how you can switch between apps that are already open) suddenly the inappbrowser opens. 当我按两次iphone主屏幕按钮(通过这种方式可以在已打开的应用程序之间进行切换)时,浏览器会突然打开。 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. 提前致谢。

It ended up being the Content Security Policy in the index.html file. 它最终成为index.html文件中的内容安全策略。

For the device ready to be fired you actually need to add gap:// to your default-src array in the 对于准备启动的设备,您实际上需要在中间的default-src数组中添加gap://

Found my answer here: Cordova deviceready not firing in iOS until interacting with iOS 在这里找到我的答案: Cordova设备准备好在与iOS交互之前无法在iOS中触发

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM