我正在尝试将 Stripe 与 meteor 一起使用来创建客户,然后向客户收费,我添加了 mrgalaxy:stripe。我正在学习本教程:http://themeteorchef.com/recipes/building-a-saas-with-meteor-stripe-part-1/ .启动 meteor 后,出现以下错误:
Refused to load the script 'https://js.stripe.com/v2/' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
Refused to load the script 'https://checkout.stripe.com/checkout.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
Uncaught ReferenceError: Stripe is not defined
manifest.json 是否有解决方法?如果是这样,它应该位于何处,它应该是什么样子,我如何读入它?
最佳答案
我能够通过更改 app/server/startup.js 来解决这个问题:
Meteor.startup( () => Modules.server.startup() );
收件人:
Meteor.startup( () => {
BrowserPolicy.content.allowOriginForAll("https://js.stripe.com/")
BrowserPolicy.content.allowOriginForAll("https://checkout.stripe.com/")
})
提出此解决方案的有用引用资料是:
关于javascript - meteor mrgalaxy :stripe package not loading content security policy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32303303/