【发布时间】:2018-04-27 00:52:38
【问题描述】:
我正在开发一个 Ruby on Rails 应用程序,我计划在其中集成 Stripe 支付。我正在使用stripe gem。我打算使用 Elements,如described here。
我包括这样的 Stripe js:
= javascript_include_tag 'https://js.stripe.com/v3/'
在我的charges.coffee 文件中,我有这个:
$(document).on 'turbolinks:load', ->
stripe = Stripe("<%= Rails.application.secrets['STRIPE_PUBLISHABLE_KEY'] %>")
elements = stripe.elements()
当我加载应用程序时,我目前在 Safari 中收到以下错误:
Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
有什么想法可以解决这个问题吗?
【问题讨论】:
-
我们应该一起阅读这篇文章stackoverflow.com/questions/8502307/…和stackoverflow.com/questions/35489518/…来解决这个问题
标签: javascript ruby-on-rails ruby stripe-payments stripe.js