无法识别的 Content-Security-Policy 指令 'worker-src' 当使用仅限客户端的 Stripe 重定向到结帐时
Unrecognized Content-Security-Policy directive 'worker-src' When using client-only Stripe redirect to checkout
所以我使用的是仅限客户端 (JS) 的 Stripe RedirectToCheckout,而且一直没有错误,这很棒。但是,我决定将 VueJS 用于我的网络应用程序。所以我通过 CDN 导入了 VueJS 并像往常一样设置它。
我已将条带结帐功能移至 VueJS 方法。但是,现在当我 运行 条纹结帐时。它像往常一样重定向我,所有测试付款都成功。但是我在控制台中出现以下错误:
Unrecognized Content-Security-Policy directive 'worker-src'.
所以我想知道两件事。
- 导致此错误的原因是什么? - 我该如何解决?
- 当我的条纹结账上线时,这个错误会成为问题吗?目前它没有造成任何重大错误。但这会是一个安全问题还是会在直播时阻止条纹工作?
shop.html
<!-- IMPORT STRIPE AND VueJS HERE -->
<div id="app">
<button class="button" v-on:click="redirectToCheckout()">Pay £{{total}}</button>
<div id="error-message"></div>
</div>
<script>
new Vue({
el: '#app',
data: {
total: 2.50
},
methods: {
redirectToCheckout() {
var stripe = Stripe('STRIPE_KEY');
stripe.redirectToCheckout({
items: [
// Add shipping fee
{sku: 'sku_HCLoshvlZRCn7S', quantity: 1}
],
successUrl: 'https://your-website.com/success.html?session_id={CHECKOUT_SESSION_ID}',
cancelUrl: 'https://your-website.com/canceled.html',
})
.then(function (result) {
if (result.error) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer.
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
}
}
})
</script>
非常感谢:)
这是 web workers and not a part of Stripe Checkout. Likely your Vue setup is attempting to register and use a worker 某处的错误。它不太可能对 Checkout 产生任何影响。
所以我使用的是仅限客户端 (JS) 的 Stripe RedirectToCheckout,而且一直没有错误,这很棒。但是,我决定将 VueJS 用于我的网络应用程序。所以我通过 CDN 导入了 VueJS 并像往常一样设置它。
我已将条带结帐功能移至 VueJS 方法。但是,现在当我 运行 条纹结帐时。它像往常一样重定向我,所有测试付款都成功。但是我在控制台中出现以下错误:
Unrecognized Content-Security-Policy directive 'worker-src'.
所以我想知道两件事。
- 导致此错误的原因是什么? - 我该如何解决?
- 当我的条纹结账上线时,这个错误会成为问题吗?目前它没有造成任何重大错误。但这会是一个安全问题还是会在直播时阻止条纹工作?
shop.html
<!-- IMPORT STRIPE AND VueJS HERE -->
<div id="app">
<button class="button" v-on:click="redirectToCheckout()">Pay £{{total}}</button>
<div id="error-message"></div>
</div>
<script>
new Vue({
el: '#app',
data: {
total: 2.50
},
methods: {
redirectToCheckout() {
var stripe = Stripe('STRIPE_KEY');
stripe.redirectToCheckout({
items: [
// Add shipping fee
{sku: 'sku_HCLoshvlZRCn7S', quantity: 1}
],
successUrl: 'https://your-website.com/success.html?session_id={CHECKOUT_SESSION_ID}',
cancelUrl: 'https://your-website.com/canceled.html',
})
.then(function (result) {
if (result.error) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer.
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
}
}
})
</script>
非常感谢:)
这是 web workers and not a part of Stripe Checkout. Likely your Vue setup is attempting to register and use a worker 某处的错误。它不太可能对 Checkout 产生任何影响。