[英]Paypal Braintree pop blocked in chrome
Paypal Braintree pop up blocked in chrome asking permissions when called from onReady method. 当从onReady方法调用时,Paypal Braintree会在Chrome询问权限中被阻止。
Below is braintree.setup onready function 下面是braintree.setup onready函数
onReady: function(integration) {
console.log('Braintree is ready');
checkout = integration;
enablePaypalBtn();
}
Below is the button code 下面是按钮代码
<button id="my-button-element" style="visibility:none"></button>
var checkout;
document.querySelector('#my-button-element').addEventListener('click',
function (event) {
event.preventDefault();
checkout.paypal.initAuthFlow();
}, false);
Whereas if I call directly my-button-element click event from console pop is shown without asking permission. 而如果我直接调用控制台弹出窗口中的my-button-元素click事件,则无需征得许可。
Full disclosure: I work at Braintree. 全面披露:我在Braintree工作。 If you have any further questions, feel free to contact support .
如果您还有其他疑问,请随时与支持小组联系。
Per Braintree's docs , initAuthFlow
must be called synchronously as result of a user click event or the PayPal flow popup will automatically be blocked by the browser. 根据Braintree的docs ,由于用户单击事件而必须同步调用
initAuthFlow
, initAuthFlow
浏览器会自动阻止PayPal流弹出窗口。 You need to tie enablePaypalBtn()
to a user click action. 您需要将
enablePaypalBtn()
绑定到用户点击操作。
Also, wanted to mention Braintree has a newer Javascript library, v3 . 另外,想提一下Braintree有一个更新的Javascript库v3 。 If you can, I recommend migrating to the newest version .
如果可以,我建议迁移到最新版本 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.