弹出 window 无法在 Ionic-v1 InAppBrowser 中打开

Pop up window won't open in Ionic-v1 InAppBrowser

我是 IONIC 的新手,正在尝试在我的 Ionic 应用程序中实现支付网关。我在外部 URL 中设置了所有内容,只是为了通过 InAppBrowser 将其加载到应用程序中。在客户决定使用 Vis 卡付款之前,一切看起来都很好,尤其是万事达卡,不幸的是,付款需要通过 Visa 验证(VBV/3DS 弹出窗口 window)作为其交易流程的一部分。

现在的问题是: pop window 不会出现在 InAppBrowser 中。我试过使用 iframe,它都是一样的。我已经调查过 Cordova Documentation on InAppBrowser 但也没有帮助。

在我的配置中: `

<access origin="*"/>
  <allow-navigation href="*" />
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>

`

TL;DR:官方 Cordova InAppBrowser (IAB) 插件不支持弹出 windows。

我在尝试使用 IAB 在 Cordova 应用程序中显示包含 Braintree JS SDK 的网页时遇到了同样的问题。

Braintree (who are now a subsidiary of PayPal) have created a "PopupBridge" which allows mobile app WebViews to open popup windows in a browser and emulate cross-frame communication between the parent (WebView) and child (browser) pages. There are versions for both Android and iOS。但是,他们的工作是针对本机应用程序,而不是 Cordova 应用程序。

所以我创建了 cordova-plugin-inappbrowser-popup-bridge,它为 Cordova 的 InappBrowser 添加了对 Braintree 的 PopupBridge 功能的支持。这使得在基于 Cordova 的 Android 和 iOS 应用程序的 InappBrowser 元素的上下文中支持 Braintree 支持的 PayPal 支付成为可能。

这可以在 IAB WebView 的 proof-of-concept example Cordova app I've created which opens the Braintree PopupBridge Example webpage 中看到。

Braintree 的 iOS 的 PopupBridge 依赖于 WKWebView(自 iOS 8 以来新的 iOS WebView),但是官方的 Cordova IAB 插件仍然使用旧的 UIWebView。因此,在我的 IAB 分叉版本中,我重写了 iOS IAB 插件以使用 WKWebView 而不是 UIWebView。

经过这么多努力,我联系了 webpay 服务提供商,他们将重定向(弹出)加载到 iFrame 上,而不是尝试将其加载到新 window 上。 这就是解决我问题的方法。