【问题标题】:Stripe - integrating with Cordova - loading app without net connectionStripe - 与 Cordova 集成 - 在没有网络连接的情况下加载应用程序
【发布时间】:2017-01-24 04:40:04
【问题描述】:
我有一个科尔多瓦应用程序。我已经将 Stripe 与它集成在一起。
它工作得很好。
但是,当应用程序启动时没有网络连接时 - 应用程序没有加载 - 我得到白屏。日志说 -
Failed to instantiate module angular-stripe due to:
Stripe must be available as window.Stripe
如何使我的应用能够通过 Stripe 加载 - 即使在没有活动互联网的情况下也是如此。可能会延迟加载 Stripe?
【问题讨论】:
标签:
cordova
stripe-payments
【解决方案1】:
您可以在需要时延迟加载条带库。
let stripe = document.createElement('script');
stripe.src = 'https://checkout.stripe.com/checkout.js';
stripe.onload = function () {
// What do to do when the library is loaded
};
document.getElementsByTagName('head')[0].appendChild(stripe);