首页 > 解决方案 > 无法在 Cordova 上加载 Stripe 3ds iframe

问题描述

我很难尝试为条纹实现 3ds。自从我更新到 cordova 10、android@9.1 和 ios@6.2 后,我无法再为 3ds 加载 iframe。意图设置正确,我在手机上收到 3ds 文本消息,但看不到 iFrameContent。我试图更改 index.html 中的 Content-Security-Policy 和 config.xml 中的 allow-navigation。

这些是我的config.xml属性:

    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="about:*" />
    <allow-navigation href="https://*/*" />

这里我如何设置 CSP:

<meta
    http-equiv="Content-Security-Policy"
    content="
             connect-src * 'self' 'unsafe-inline';
             script-src * 'self' 'unsafe-inline';
             frame-src https://*.stripe.com;"
>

这是我得到的错误:

错误

根据条带文档,您需要将这些规则附加到您的 CSP

条纹

但我仍然无法加载包含 3ds 的 iframe。

在此处输入图像描述

有什么线索吗?谢谢!

标签: cordovaiframestripe-paymentscontent-security-policy

解决方案


尝试使用 ionic webkit "cordova-plugin-ionic-webview",添加

    <preference name="ScrollEnabled" value="true" />
    <preference name="Scheme" value="https" />
    <preference name="MixedContentMode" value="2" />

到您的 config.xml(这是 ionic-webview 特定的),最后添加frame-ancestors 'self' https://*.stripe.com;到您的 csp 配置中。

它对我有用


推荐阅读